logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Video Tutorials
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 05-21-2008, 01:03 PM   #1
3ppps
 
Join Date: May 2008
Posts: 24
Default Stuck on Part 9 Inserting data with php

Hi
1st Post so go easy:

Im stuck on the video part 9 inserting data with php, at the end of the turtorial where you insert the data and click submit, the data then updates in the table below

Unfortunately this is not happening for me, the table remains the same
some part of my code must be wrong or something

can you help
Thanks in Advance, Very Good Videos Keep Up The Good Work


**************below is my connection.php
PHP Code:
<?php 
$database 
"dwc";
$username "dj";
$password "********";
$link = @mysql_connect('localhost'$username$password);
$db mysql_select_db($database$link);
?>
**************below is my dwc.php
PHP Code:
<?php
require_once("connections/connection.php"); 
 
$data2 $_post ['data2'];
$data3 $_post ['data3'];
$data4 $_post ['data4'];
$submit $_post ['submit'];
 
if (
$submit && $data2 && $data3 && $data4) {
 
$query sprintf("INSERT into table1 (field2,field3,field4) values ('$data2', '$data3', '$data4')");
mysql_query ($query) or die (mysql_error());
 
}elseif (
$submit) {
echo 
"One of your fields is empty !";
}
 
$query sprintf("SELECT * FROM table1");
$result = @mysql_query($query);
$row mysql_fetch_array($result);
/*do {
echo $row['field3'] ."<br>";
}while ($row = mysql_fetch_array ($result));*/
?>
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="<?php $_SERVER['PHP_SELF'];?>">
<table width="400" border="1">
<tr>
<td>data2</td>
<td>data3</td>
<td>data4</td>
</tr>
<tr>
<td><label>
<input type="text" name="data2" id="data2" />
</label></td>
<td><label>
<input name="data3" type="text" id="data3" value="" size="45" />
</label></td>
<td><label>
<input name="data4" type="text" id="data4" value="" size="45" />
</label></td>
</tr>
<tr>
<td colspan="3"><label>
<div align="center">
<input type="submit" name="Submit" id="Submit" value="Submit" />
<input name="submit" type="hidden" id="submit" value="1" />
</div>
</label></td>
</tr>
</table>
</form>
<p>&nbsp;</p>
<table width="400" height="135" border="1">
<tr>
<td width="32"><div align="center">id1</div></td>
<td width="46"><div align="center">data2</div></td>
<td width="46"><div align="center">data2</div></td>
<td width="190"><div align="center">data3</div></td>
</tr>
 
<?php do { ?> 
<tr>
<td> <div align="center"><?php echo $row ['field1_id'];?></div></td>
<td><div align="center"><?php echo $row ['field2'];?></div></td>
<td><div align="center"><?php echo $row ['field3'];?></div></td>
<td><div align="center"><?php echo $row ['field4'];?></div></td>
</tr>
 
<?php }while ($row = mysql_fetch_array($result));?>
</table>
</body>
</html>
3ppps is offline   Reply With Quote
Old 05-21-2008, 02:01 PM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

PHP Code:
$_post ['data2']; 
Your post vars should be Capitals

Like this... (and $_POST< no space here >['data2'])

PHP Code:
$_POST['data2']; 
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 05-21-2008, 03:44 PM   #3
3ppps
 
Join Date: May 2008
Posts: 24
Default

Thanks D

That worked fine

Also when watching the videos on PHP Arrays, Functions and Classes is there any way that I can view them in Camtasia Studio 4 the same way as the others, ie to stop and pause etc

Thanks
Paul
3ppps is offline   Reply With Quote
Old 05-21-2008, 07:35 PM   #4
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

Mmmm

It works for me?
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 05-21-2008, 08:18 PM   #5
3ppps
 
Join Date: May 2008
Posts: 24
Default

Hi d
In ie7 and firefox both the videos are central on screen with the dreamweaver club in the background either side, they also take forever to download in ie7
They download a lot quicker in firefox but the sound quality is distorted
Is there any way you can email or file transfer them to me, all the other videos are fine so not sure as to what is going on
Thanks Paul
3ppps is offline   Reply With Quote
Old 05-21-2008, 08:21 PM   #6
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

will look into this
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 05-21-2008, 08:31 PM   #7
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

in IE try right clicking the link to the tut and then open in new window

Report back if its quicker
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 05-21-2008, 08:48 PM   #8
3ppps
 
Join Date: May 2008
Posts: 24
Default

Hi d
In ie7 and firefox both the videos are central on screen with the dreamweaver club in the background either side, they also take forever to download in ie7
They download a lot quicker in firefox but the sound quality is distorted
Is there any way you can email or file transfer them to me, all the other videos are fine so not sure as to what is going on
Thanks Paul
3ppps is offline   Reply With Quote
Old 05-21-2008, 08:55 PM   #9
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

in IE try right clicking the link to the tut and then open in new window

Report back if its quicker
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 05-21-2008, 09:01 PM   #10
3ppps
 
Join Date: May 2008
Posts: 24
Default

Hi d

That works fine, once again thank you

P
3ppps is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:57 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com