How to add data and view them

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kalp1200
Forum Newbie
Posts: 19
Joined: Tue Aug 26, 2008 8:57 pm

How to add data and view them

Post 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;
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: How to add data and view them

Post 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
Post Reply