Re: I am confused to mysql_query.
| From: | Patrik Hasibuan | Date: | Wed, 01 Aug 2007 08:15:43 +0000 |
| Subject: | Re: I am confused to mysql_query. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259974@lists.php.net to get a copy of this message | ||
Hi Sichta,
That's what I am confused. Quoted or no Quote makes no effect. mysql_query does not work.
I tried to debug with "..or die (mysql_error());" but it seems "mysql_error()"
does not exist anymore.
Please keep telling me. I've wasted to much time today hanging around with this weird problem.
====
On Wed, 1 Aug 2007 08:27:51 +0200
"Sichta, Daniel" <Daniel.Sichta@siemens.com> wrote:
> Hi ,
>
> Try this:
> $hsl=mysql_query($stringsql,$koneksi);
>
> DS
>
> -----Original Message-----
> From: Patrik Hasibuan [mailto:patrikh@penguin-teknologi.com]
> Sent: Wednesday, August 01, 2007 8:23 AM
> To: php-general@lists.php.net
> Subject: [PHP] I am confused to mysql_query.
>
> Dear my friends...
>
> This sql string produces proper output in my MySQL-Query:
> select image_src from products where product_id='10';
> the output is:
> gambarproduk/0/10/1.jpg
>
> But my php code does not produce anything.
>
> Please tell me what is my mistake.
> ===
> <?php
> if (isset($pid)){
> $koneksi=mysql_connect("127.0.0.1","root","mysuccess");
> $stringsql="select style,
> description,
> price
> from styles
> where product_id='$pid';";
> $hsl=mysql_query("$stringsql","$koneksi");
> while ($brs=mysql_fetch_row($hsl)){
> list($edisi,$deskripsi,$harga)=$brs;
> }
>
> $konek=mysql_connect("127.0.0.1","root","mysuccess");
> if ($konek){
> echo "konek berhasil <br>";
> $sqlgbr="select image_src
> from products
> where product_id='$pid';";
> echo "$sqlgbr <br>";
> $hslgbr=mysql_query("$sqlgbr","$konek");
> if (!$hslgbr){
> echo "query gambarproduk tidak berhasil <br>";
> }elseif ($hslgbr){
> echo "array gambar";
> }
> while ($brsgbr=mysql_fetch_row($hslgbr)){
> list($gambarproduk)=$brsgbr;
> echo "urlgambar: $gambarproduk <br>";
> }
> }
> }
> ?>
> ===
> --
> Patrik Hasibuan <patrikh@penguin-teknologi.com>
> Junior Programmer
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--
Patrik Hasibuan <patrikh@penguin-teknologi.com>
Junior Programmer