Page 1 of 1

How to add data and view them

Posted: Mon Feb 02, 2009 3:53 am
by kalp1200
Hi guys, I have posted the same topic before but I am doing something wrong, anyway I seriously have to get this thing done

I managed to do the insert page.

I need the page to double confirm the data just entered,how do i go about doing it, I have set up sessions and the table has an autoincrement field. The username is stored as the session.

Any help would do, perhaps a guide, I just need to the technical aspects, I am so lost.

this is my page, that displays the data entered, but no data is displayed
<?php
include ('php/connect.php');
$username1 = $_SESSION['userName'];
$sqlquery1 = "SELECT * from record_db_desktopmodel";
$id = $_GET['id'];
$query = mysql_query("SELECT * from record_db_desktopmodel where id= '$id'");
$row = mysql_fetch_array($query);
?>

this is the page that adds them

$sql="INSERT INTO record_db_desktopmodel(desktop_model,desktop_manufacturer,desktop_casing)VALUES('$desktop_model','$desktop_manufacturer','$desktop_casing')";

$URL="../viewdesktopinline.php?id=echo mysql_insert_id()";


can someone help, the data is entered, its just not displayed

is there any other way, if I dun use mysql_insert_id;

Re: How to add data and view them

Posted: Mon Feb 02, 2009 3:58 am
by papa
You need to loop out $row = mysql_fetch_array($query);

Read the example here:
http://us2.php.net/manual/en/function.m ... -array.php