# Anyone with PHP experience want to tell me what's wrong,,,

**URL:** <https://forum.kirupa.com/t/anyone-with-php-experience-want-to-tell-me-whats-wrong/3254>\
**Category:** Uncategorized\
**Created:** [April 20, 2002, 6:29pm UTC](https://forum.kirupa.com/t/anyone-with-php-experience-want-to-tell-me-whats-wrong/3254 "2002-04-20T18:29:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 20, 2002, 6:29pm UTC](https://forum.kirupa.com/t/anyone-with-php-experience-want-to-tell-me-whats-wrong/3254/1 "2002-04-20T18:29:48Z")

</div>

…with this script\r\rinclude\_once (“filelock/db\_include.php”);\r//make connection\r$connect = mysql\_connect($db\_host,$db\_user,$db\_password);\r//select database\rmysql\_select\_db($db\_name,$connect);\r//query table\r$result=mysql\_query(“SELECT \* FROM $table\_name,$connect);\r$counter=0;\rwhile ($myrow = mysql\_fetch\_array($result)){\rprintf(”&date$counter=%s&name$counter=%s&email$counter=%s&site$counter=%s&comment$counter=%s",rawurlencode($myrow[“date”]),rawurlencode($myrow[“name”]),rawurlencode($myrow[“email”]),rawurlencode($myrow[“site”]),rawurlencode($myrow[“comment”]));\r$counter++;\r}\r$flag="&flag=true";\recho “$flag”;\r\rI’m getting a parse error on line 11… which in the case of the script above is line 10 because I left off the php opener and closer tags. So it’s the “printf” line

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 20, 2002, 6:37pm UTC](https://forum.kirupa.com/t/anyone-with-php-experience-want-to-tell-me-whats-wrong/3254/2 "2002-04-20T18:37:31Z")

</div>

Im just gettin’ started with php, never used mySql before, so…\r\r1. what’s the f in printf for?\r2; “while ($myrow = mysql\_fetch\_array($result)){” looks weird to my unknowing eyeZ; you use a single = and where does the loop get incremented?\r\rJust guessing…\r\rPS: you should ask 'bout this at [www.phpforflash.com](http://www.phpforflash.com) , good forum…)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 20, 2002, 6:59pm UTC](https://forum.kirupa.com/t/anyone-with-php-experience-want-to-tell-me-whats-wrong/3254/3 "2002-04-20T18:59:26Z")

</div>

there’s a counter++ at the bottem\r\rthe printf command comes from Flash Developer’s Guide.\r\rReally all I want to do is query the table and then send all that data to flash… every row, every column… If you have another script that would work better, I’d be happy to use it instead.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 21, 2002, 5:20am UTC](https://forum.kirupa.com/t/anyone-with-php-experience-want-to-tell-me-whats-wrong/3254/4 "2002-04-21T05:20:56Z")

</div>

“there’s a counter++ at the bottem” …\ryes, but where is it used in the while so the condition check ever gets false?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 21, 2002, 1:10pm UTC](https://forum.kirupa.com/t/anyone-with-php-experience-want-to-tell-me-whats-wrong/3254/5 "2002-04-21T13:10:50Z")

</div>

Well… I got it working… so I know it works… 🙂 \r\rwhile ($myrow = mysql\_fetch\_array($result)){\r printf("&date$counter=%s&name$counter=%s&email$counter=%s&site$counter=%s&comment$counter=%s",rawurlencode($myrow[“date”]),rawurlencode($myrow[“name”]),rawurlencode($myrow[“email”]),rawurlencode($myrow[“site”]),rawurlencode($myrow[“comment”]));\r$counter++;\r}\r\rthe counter incriments every time the script runs through. the counter itself though, is not what stops the loop, its the mysql\_fetch\_array command that does that. The counter is just there to add a unique number to the end of each of the array items.
