Jump to content

Warning: mysql_fetch_array() expects parameter 1 to be resource


whayooe

Recommended Posts

i have the syntax to display the article but there is a problem in his line 5 ..

anyone can help me.

 

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\json-parsingxml2\artikel-xml.php on line 5

{"agenda" : []}

 

 

<?php

include("koneksi.php");

$q = mysql_query('SELECT * FROM agenda');

$v = '{"agenda" : [';

while($r=mysql_fetch_array($q))

{

$ob = array('"','<br>','</br>');

 

$v .= '{"id" : "'.$r['id_agenda'].'",

"tema" : "'.str_replace($ob,' ',strip_tags($r["tema"])).'",

"isi_agenda" : "'.str_replace($ob,' ',strip_tags($r["isi_agenda"])).'",

"tempat" : "'.str_replace($ob,' ',strip_tags($r["tempat"])).'",

"pengirim" : "'.str_replace($ob,' ',strip_tags($r["pengirim"])).'",

"tgl_mulai" : "'.str_replace($ob,' ',strip_tags($r["tgl_mulai"])).'",

"tgl_selesai" : "'.str_replace($ob,' ',strip_tags($r["tgl_selesai"])).'",

"jam" : "'.str_replace($ob,' ',strip_tags($r["jam"])).'"}';

 

}

$v .= ']}';

echo $v;

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.