Re: Arrays / Strings

From: Date: Sun, 12 Nov 2000 13:49:23 +0000
Subject: Re: Arrays / Strings
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24859@lists.php.net to get a copy of this message
At 8:26 AM -0500 11/12/00, Website4S@aol.com wrote:
Hi, I have run into a small problem with my Arrays, I have selected * from my table Where (ID) then I use...
          mysql_data_seek($SQLResult, 0);
          $array=mysql_fetch_array($SQLResult);
which works fine and it allows me to use <?printf($array["Fname"]);?> <?printf($array["Surname"]);?> on my page, and the correct Fname and Surname is printed according to the Where statement. What I want to do however is put Fname and Surname into a string called $Name which I can then use in a seperate database table but I can`t for the life of me get it to work. All I can get is either a blank $Name or this error... Parse error: parse error, expecting STRING' or NUM_STRING' or `'$'' If any one knows of any code any where or knows the solution please drop me an email.
hi there. if i'm not understanding your question, lemme know, but if you're just trying to get a string of the whole name somehow, then do one of the following: (1) $whole_name = $array["Fname"] . " " . $array["Surname"]; (2) Select the whole name out of the database. In MySQL, you would use: SELECT *, CONCAT(Fname," ",Surname) as whole_name FROM table Then, in your acript, after you call mysql_fetch_array(), you'll have this available: $array["whole_name"] Hope this helps, -- Marc Antony Vose http://www.suzerain.com/ I'm looking for something in an after dinner burrito. -- Homer Simpson

« previous php.general (#24859) next »