| | |
string variable question
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 227
Reputation:
Solved Threads: 0
hi, i selected everything from the table and the direct variable $cResult[3] would give me something like "street address with space as delimiter" ... however, when i tried to use it, it will give me only "street" instead of "street address with space as delimiter".
does anyone know how i can fix it so it will show the whole field?
thanks
does anyone know how i can fix it so it will show the whole field?
thanks
PHP Syntax (Toggle Plain Text)
<?php require_once('auth.php'); require_once('config.php'); $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } $cid = $_SESSION['SESS_CUSTOMER_ID']; $qry="SELECT fname, lname, email, streetAddress,zip_id, passwd FROM customer WHERE customer_id='$cid'"; /////////////////// problem begin ////////////////////////////////// $cResult=mysql_fetch_array(mysql_query($qry)); $fn= "$cResult[0]"; $ln= "$cResult[1]"; $email= "$cResult[2]"; $street= "$cResult[3]"; //---> this will give me only part of the field (the first word basically) ///////////////// problem end ///////////////////////////////
Try replacing the problem area with the following:
php Syntax (Toggle Plain Text)
$cResult=mysql_fetch_array(mysql_query($qry)); $fn=$cResult[0]; $ln=$cResult[1]; $email=$cResult[2]; $street=$cResult[3];
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
•
•
Join Date: Nov 2007
Posts: 227
Reputation:
Solved Threads: 0
•
•
•
•
Try replacing the problem area with the following:
php Syntax (Toggle Plain Text)
$cResult=mysql_fetch_array(mysql_query($qry)); $fn=$cResult[0]; $ln=$cResult[1]; $email=$cResult[2]; $street=$cResult[3];
i will try again later but i think i already tried that and didn't work.
Just a thought, is your 4th field (street) long enough to take the whole street name. Check in phpmyadmin or whatever you use to admin your db to see if the data in 'street' is complete.
If this ain't a problem, have you got any strange characters following the first word?
If this ain't a problem, have you got any strange characters following the first word?
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
•
•
Join Date: Nov 2007
Posts: 227
Reputation:
Solved Threads: 0
•
•
•
•
Just a thought, is your 4th field (street) long enough to take the whole street name. Check in phpmyadmin or whatever you use to admin your db to see if the data in 'street' is complete.
If this ain't a problem, have you got any strange characters following the first word?
nope, no strange characters. the field is long enough and the street i inserted "132 main street" was already stored in the table.
but it is weird that [code] echo "$cResult[3]" returns me only "132"
•
•
•
•
but it is weird that [code] echo "$cResult[3]" returns me only "132"
php Syntax (Toggle Plain Text)
echo '`column`="'.mysql_real_escape_string('132 main street').'"'; mysql_query('INSERT INTO `table` SET `column`="132 main street"') or die(mysql_error());
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
![]() |
Similar Threads
- how to enable/disable ToolStripMenuItem Name using String variable (VB.NET)
- Double quotes inside string variable. e.g " my name is "jaikit" and what is " (ASP.NET)
- how to use a string variable (C++)
- How to Retrieve THAI Language Data From SQL Server 2000 to string variable (Visual Basic 4 / 5 / 6)
- value of a variable whoose name is in another string variable... (Java)
- setting a string as a variable name (Python)
- Convert string variable into form object in VB6 (Visual Basic 4 / 5 / 6)
- Need help passing database column value to a string variable. (ASP.NET)
- Search for a string in a variable--- (PHP)
- Problem with string variable in void prnt function (C++)
Other Threads in the PHP Forum
- Previous Thread: ImageCreateFromPNG
- Next Thread: Free Open Source Software
| Thread Tools | Search this Thread |
advanced apache api array beginner binary broken cakephp checkbox class cms code cookies cron curl database date datepart display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google head href htaccess html if...loop image include includingmysecondfileinthechain insert ip javascript job joomla jquery key library limit link login mail menu mlm multiple mysql oop password paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search server sessions smarty sms soap sorting source space sql startup stored syntax system table traffic tutorial update upload url validator variable video web xml youtube zend






