[PHP] Multiple Inserts
Hi, I am trying to do some multiple inserts using the following code but it doesn`t seem to work, it inserts the first one but then the second is inserted as blank. Where the value being passed is $Emails="[EMAIL PROTECTED], [EMAIL PROTECTED]"; ? // Get Login info require("blah..."); // Connect to MySQL $connection=mysql_connect($host, $user, $pass); // Format the Emails $Emails1=str_replace(" ","",$Emails); $GetEmails=explode(",",$Emails1); // Insert into Members Database for ($a=0;$acount($GetEmails);$a++){ $SQLStatement = "INSERT INTO Members (Email) VALUES ('".$GetEmails[$a] ."')" or die ("Problem"); $db = mysql_select_db($dbase, $connection); $SQLResult = mysql_query($SQLStatement); } ? Anyone know what might be going wrong, or perhaps I have the wrong method? Thanks Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Multiple Inserts
In a message dated 09/03/2001 12:38:08 GMT Standard Time, [EMAIL PROTECTED] writes: Whoa, you're mixing apples with oranges. Try: $db = mysql_select_db($dbase, $connection); $SQLStatement = "INSERT INTO Members (Email) VALUES ('" . $GetEmails[$a] . "')"; //removed the 'or die' portion $SQLResult = mysql_query($SQLStatement,$connection) or die ("Problem " . mysql_error() ); //moved 'or die' here, using more detailed info -- CC Still no joy, and it doesn`t give out any errors whatsoever. Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Generate Random Letters?
I know it is possible to generate a random number using rand() I don`t suppose there is anyway to generate a random letter sequence that anyone knows of? Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Escape %
Hi, Anyone know the best method to escape the % sign in PHP? I`ve checked the manual and devshed and didn`t come across much, is there a command like addslashes() or would I have to use something like this... $Field="A%D%E"; $Field1=str_replace("%","percent",$Field); Thanks for any input Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Escape %
In a message dated 26/02/2001 07:17:57 GMT Standard Time, [EMAIL PROTECTED] writes: there is addslashes(); http://www.php.net/manual/en/function.addslashes.php john addslashes() doesn`t work on the % sign though Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Display Format
Hi, I`m using the following code to display the contents of a file. ? $filename = "category/category.inc"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); $content = explode (",", $contents); for ($a=0;$acount($content);$a++){ printf("TRTDA HREF='showcat.php?Cat=%s'%s/A/TD/TR", str_replace(" ","",strtolower($content[$a])), $content[$a]); } ? It is working fine at the moment but I want to try and be a tad more ambitious, say for example the category.inc contains the following: Paul,Mark,Tom,Ade My code will display the results like so... (Obviously with my HTML in there too) Paul Mark Tom Ade Firstly is there any way I can sort these in alphabetical order?? More importantly is there any way of formatting them so they display Paul Mark Tom Ade So they are in two columns in a table rather than one?? Thanks for any help Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] No result - need advice.
Try adding where the Values go "INSERT INTO memberstest (Name, ICQ, Location) VALUES ('', '$name', '$icq', '$loc', '$active', '$date', '$mlist', '$email', '$url', '$year', '$make', '$model', '', '$et', '$mph', '$six', '$track', '$engine', '$notes', '', '$pass', '$drive', '$cab', '$length', '', '$aim', '$irc', '$city', '$bday', '$color', '$emods', '$tmods', '$elec', '$hmods', '$bmods', '$app', '$audio', '$user', '$vin')"; Where Name, ICQ and Location are all Valid table rows HTH Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Directing Email to a script
Hi, I`m sure its possible but I can`t find any info on it, anyone know of any source or tutorials etc about directing email to a PHP script. TIA Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Removing Whitespace
Hi, I found it on DevShed, if anyone else is interested the code is $your_string = str_replace(" ","",$your_string); Regards Ade Hi, Does anyone know of the code to remove all whitespace from a string. E.G if input is 'Hello I was here' I want it to come out as 'HelloIwashere' I`m searching the manual as I type this but can`t find anything. TIA Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP vs JSP
Hi, Just wondering if anyone knows of any links to information relating to PHP vs JSP where PHP is my language of choice and another developer is recommending JSP but I know nothing about JSP to help me convince the buyer that PHP is a better choice. A question that was raised is that PHP cannot be integrated with C++ for large functions etc. My response was that I haven`t found a function that PHP cannot handle therefor integration was not a requirement Anyone else have any valid upside or downsides to the languages which could help Thanks Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Capturing Emails
Hi, What is the best way to capture an email sent to a server so that I can copy it and send it to a number of emails selected from a db. I can do the scripting except for the capturing part (Presuming I have no idea when the email is sent to the server) Any links regarding this subject would be gratefully recieved. Thanks Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Cron + PHP
Hi, Yes just make the path lead to the file on your server. Regards Adrian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] getimagesize question
Hi, I`m using the following to get the image size... $size = getimagesize("$Frame"); My problem is $Frame can`t contain the full name of the image for various reasons, so what I need to do is somehow add the rest, something along the lines of this... $size = getimagesize("$Frame'top.gif'"); If $Frame = Hello then the getimagesize would perform on Hellotop.gif but as yet it isn`t working anyone have a suggestion? I have tried a few variations such as ("$Frame" + "top.gif") ("$Frame\"top.gif\"") ($Frame"top.gif") Thanks Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] getimagesize question
Tom, Thanks for that, worked a treat. Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Email Attachment
Hi, I know how to send a standard email, but I`m having a bit of trouble adding an attachment, can anyone put me right? this is my code which works fine... $subject="Hi"; $email="[EMAIL PROTECTED]"; $from="[EMAIL PROTECTED]"; $message="Hi this is me testing my PHP mail script"; mail($email, $subject, $message, $from); TIA Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] verify that email exist ?
Hi, I don`t think it is possible to check that an email actually exists but what you could do is make them confirm there email by sending them a code, if they enter the right code on the next page then they have recieved the email and it obviously exists. HTH Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Editor
Hi, I know this has been asked before but I can`t seem to get the archive email thingy to work, basically I`m looking for a free or cheap editor that has the lines numbered so that it`s a bit easier for me to debug my scripts. TIA Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Ideas?? (OT- MySQL)
Thanks for the input, I have turned it around now as you said and recorded the projectID in the bid table rather than the other way round. Cheers Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] No Cookies
Hiya, I have a secure area on my site which users log into, once logged in all areas are linked together but I use a hidden form to authenticate, it works great but the only problem is if refreshed it makes the user log in again, just wondering if there are any other decent ways to authnticate without using cookies?? Cheers Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Ideas?? (OT- MySQL)
Hi, I am creating a web site which allows users to post projects and then others to place bids. I am setting up two tables in MySQL 'Projects' 'Bids' my problem is how best to cross reference. What I was thinking of doing is creating a number of fields in the Projects table... Bid1 Bid2 Bid3 etc and then inserting the BidID from the bids table into Bid1, and if that is already used then it will go into Bid2. But how many Bid# shall I create?? I`m sure there must be a faster method than this, anyone have any suggestions?? TIA Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Turning off scrollbar
Hi, Can anyone tell me how to turn off the bottom scrollbar in both IE and Netscape?? TIA Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Some Code for Uploading Images...
In a message dated 23/01/2001 19:01:16 GMT Standard Time, [EMAIL PROTECTED] writes: By the way, do you know of a site with PHP samples? www.hotscripts.com www.devshed.com www.phpbuilder.com www.zend.com www.php.net www.thickbook.com www.weberdev.com That should keep you going, as for the other part of your query sorry I can`t help with that as I haven`t been down that road yet. Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Profanity Filter
Hi, I`m trying to use the code below for my profanity checker but it keeps returning a parse error on the second line 'while ((list etc' Can anyone see anything wrong?? TIA Ade $done=false; while ((list($key, $val)=each($words)) and $done===false) { $done=strpos(strtolower($name), $val); }; if ($done!==false) { // Oops! Bad name. } else { // Okay, valid name. }; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Verifying against a file
Hi, I have used the following code to open a file $fd=fopen("words.txt", "r"); $words = fread($fd, 100); I then convert a string which is passed in a form to this script $FirstName=strtolower("$FirstName"); And now I check to see if the lowercase version of $FirstName contains any of the words from the $words if ($FirstName=="$words") { echo "Bad"; } But it doesn`t seem to want to work, anyone give me a pointer as to where I am going wrong with this?? Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] MySQL Access Denied
Hi, I am trying to conect to a MySQL db and no matter what code I use I am always getting denied, I know the password is correct as I have tested it elsewhere. Just wondering if this could be caused by the fact that the password has a + and a . in it. Would that get me denied, and how can I get around it other than changing the PW ?? TIA Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Getting part of a string
Hi, I have a form which users enter their email address, once submitted I need a way to chop it up and put it in lowercase. So that if a user submits [EMAIL PROTECTED] I want PHP to throw out Website4S and then make the rest lowercase so I would get @aol.com I know how to get the string to lowercase by using $Email1=strtolower($Email); My problem is how to get $Email and chop off anything up to the @ and because people may enter different email providors I have no idea how to get around it. Anyone have a suggestion I would really appreciate it. Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Getting part of a string
In a message dated 21/01/2001 03:43:19 GMT Standard Time, [EMAIL PROTECTED] writes: if( eregi( "^([^@]+)@([^@]+)$", $email, $match)) { $email_user = $match[1]; $email_domain = strtolower( $match[2]); echo "$email_user at $email_domain"; } else echo "bad email"; Thank you m. that works perfect! Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Profanity Filter
Hi, I`m trying to setup a little profanity filter for a client of mine just wondered if anyone could offer some advice on how best to handle it. I was thinking of going along these lines... $filter="moron"; if($Name==$filter) { printf...Javascript you can`t use that etc } Name is passed from a form, the problem is there are going to be quite a few words, so how is the best way to store these words. Something like this?? $filter="moron idiot pratt" And if $Name was sent through as "moron pratt" would it still pick it up?? TIA for any help Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Apache .htaccess Help (OT)
Hi, Sorry this is off topic but I just can`t find anywhere with reliable information to help me get my .htaccess working on my server. I have followed many tutorials and none of them give me a working password protected dir, so if anyone can help I would appreciate it. My .htaccess file is as follows: AuthUserFile /usr/home/ukgs/volunteer/.htpasswd AuthGroupFile /dev/null AuthName Bill's Restaurant AuthType Basic limit GET require user shaun101 /limit And My .htpasswd file just contains the user shaun101 with the scrambled up password. They are both in the same directory so when I log into my server I first click usr then home etc etc. But for some reason no matter what I do I still get direct access to the directory volunteer when I go to it in a browser. Anyone have any ideas what I`m doing wrong?? TIA Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Strings??
Quick Question. I have a form which has 10 fields, is there any way in PHP to take the values once submitted and create a string for each?? Thanks Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]