| | |
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.
http://syntax.cwarn23.net/
My favourite PC. - Oopy Doopy Do 2U2!
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - Oopy Doopy Do 2U2!
•
•
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?
If you don't reply to your own thread or you can't find the solved link - you're off my Christmas list - permanently! Bah humbug!
•
•
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.
http://syntax.cwarn23.net/
My favourite PC. - Oopy Doopy Do 2U2!
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - Oopy Doopy Do 2U2!
![]() |
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
Views: 259 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date datepart directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql oop parse password paypal pdf php problem query radio random recursion regex remote script search select seo server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web webdesign xml youtube






