Jumat, 09 Agustus 2013

PHP Indonesia - Facebook: In a loop like following, the variables can be acc...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
In a loop like following, the variables can be acc...
Aug 9th 2013, 17:25, by Shah Nawaz

Shah Nawaz 5:25pm Aug 9
In a loop like following, the variables can be accessed outside the loop but only under the loop. I want to access those variables above the loop. Is it possible?

$scoresql = "SELECT * FROM quizscore WHERE user_id=" . $_GET['id'] . ";";
$scoreresult = mysql_query($scoresql);
while($scorerow = mysql_fetch_assoc($scoreresult)){
// Variables
}

Gunawan Mujur Wibisono 5:29pm Aug 9
copas dari phpmyadmin..

Pundhi Akbar Prakarso 5:35pm Aug 9
Mr. Shah Nawaz ,
Sukwinder Jit Singh said, why double ";"; ?
is it true ??

Gunawan Mujur Wibisono 5:36pm Aug 9
what I read here.. You want to see the first value/loop data>??

Shah Nawaz 5:39pm Aug 9
Gunawan, if I use the variable after the loop, it works! but if I use the variable before the loop, it gives "Notice: Undefined variable:" error!

Gunawan Mujur Wibisono 5:47pm Aug 9
you can erase the error by use error_reporting(1);
or just give the variable before mysql_query()

Shah Nawaz 5:48pm Aug 9
Gunawan, it's not only about the error... The variable has no value... If I use it below or inside the while loop, it has the value.

Gunawan Mujur Wibisono 5:54pm Aug 9
to have the value. you must type $scorerow = mysql_fetch_assoc($scoreresult) first

Shah Nawaz 6:00pm Aug 9
Would you like to see my code?

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar