| | |
Result without while loop
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 496
Reputation:
Solved Threads: 0
Hi,
Code below always returns only 1 record therefore i don't need while. How can i get result without while loop?
Thanks
Code below always returns only 1 record therefore i don't need while. How can i get result without while loop?
Thanks
PHP Syntax (Toggle Plain Text)
$q="SELECT id FROM login WHERE username='$username'"; $sql=mysql_query($q); if (@mysql_num_rows($sql)==1) { while ($arr=mysql_fetch_array($sql)) { $id=$arr["id"]; } }
php Syntax (Toggle Plain Text)
$q="SELECT id FROM login WHERE username='$username'"; $sql=mysql_query($q); if (@mysql_num_rows($sql)==1) { $arr=mysql_fetch_array($sql); $id=$arr["id"]; }
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result (PHP)
- factorial using a for loop (C++)
- the value of foreach loop keeps increasing (PHP)
- Write a calculator program using a do-while loop (C++)
- infinite loop (C++)
- Unable to open Internet explorer and it gives result "The page cannot be displayed" (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: Insert multiple checkbox values of array into mysql db
- Next Thread: Ajax Search as google?
| Thread Tools | Search this Thread |
ajax apache api array basics beginner binary bounce broken cakephp checkbox class cms code codingproblem combobox cron curl database date display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration interactive ip java javascript joomla js limit link login mail menu mlm mobile multiple mysql nodes oop outofmemmory paging parse paypal pdf php problem procedure query radio ram random recursion regex remote return script search server sessions smash sms soap source space sql syntax system table tutorial up-to-date update upload url validation validator variable video web webapplications websitecontactform xml youtube






