<?php


	session_start();


	


	$_SESSION['title'] = $_GET['form_book_title'];


	$_SESSION['ISBN'] = $_GET['form_book_ISBN'];


	$_SESSION['qty'] = $_GET['form_book_qty'];


	$_SESSION['fName'] = $_GET['form_book_fName'];	


	$_SESSION['lName'] = $_GET['form_book_lName'];


	


if($_SESSION['ISBN']=="" || $_SESSION['title']=="" || $_SESSION['qty'] =="" || $_SESSION['lName'] =="" || $_SESSION['fName'] =="")


{


	echo "please fill out all the form fields";


	echo "<a href=\"sell.html\"> Go Back";


}else 





require_once("db_info.php");


$con = mysql_connect($localhost,$username,$pw);




    if(!$con) exit(mysql_error());

    



    $db_select = mysql_select_db("book",$con) or exit(mysql_error());



    $my_query = "INSERT INTO book_tbl (title)VALUES('".$_SESSION['title']."') ";

    $result = mysql_query($my_query) or die(mysql_error());

     

   

     while($row = mysql_fetch_array($result,$con))

            echo $row['title'];


mysql_close($con);


?>

Recommended Answers

All 7 Replies

can anyone tell me what are the possible mistakes may cause the error message "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in"?n given in"?

i mean except the SQL syntax error...
i have been checking my SQL syntax, and i think it does not have problem.


this is my database structure

Hi

Try to Remove $con from line 72

You are trying to get results from an INSERT query - you also need a SELCT query after your INSERT query to load results into your mysql_fetch_array and while loop

mysql_query("INSERT INTO book_tbl (title)VALUES('".$_SESSION['title']."') ");

$my_query = "SELECT title FROM book_tbl";
    $result = mysql_query($my_query) or die(mysql_error());
   

     while($row = mysql_fetch_array($result,$con))

            echo $row['title'];
}

wow, that makes sense
thank you simplypixie and rpv_sen

Hi

If your issue is solved. Please mark the thread as solved

No problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.