Contact over msn to help fix my problem

goldy30

New Member
Messages
60
Reaction score
0
Points
0
I'm trying to insert title and blurb into the database but it's not working. It's actually code which someone else gave me. Still learning.

Heres what I have:
PHP:
<?php
include ("../database.inc");
?>
<?php
$pageid=$_POST["pageid"];
$details = mysql_fetch_array(mysql_query("SELECT pagename, blurb FROM pages WHERE pages_id='".$pageid."'"));
?>

In the body:
PHP:
<td>
                                Title:<br>
                                <?php
                                echo '<input name="title" size="40" value="'.$details[0].'" type="text">'; // this code should  be for your title ?><br>
                            </td>
                        <tr>
                            <td>
                                Page Info:<br>
                                <?php

                                echo '<textarea name="blurb" rows="7" cols="60">'.$details[1].'</textarea>'; // this code should  be for your Page Info at text area
                                ?>
                                
                            </td>

and this is the insert.php file:
PHP:
<?php
include ("../database.inc");
?>
<?php
$pageid = $_POST['pageid'];
$blurb = $_POST['blurb'];
$title = $_POST['title'];

mysql_query("INSERT INTO `pages` ('title','blurb') VALUES ('$title','$blurb') WHERE `pages_id` = '0'");  
?>

<?php

I would appreciate if someone could contact me on msn airbrushkits@live.com and I can send you files, upload and check changes.
 

mephis

New Member
Messages
39
Reaction score
0
Points
0
PHP:
<?php
include ("../database.inc");
?>
<?php
$pageid = $_POST['pageid'];
$blurb = $_POST['blurb'];
$title = $_POST['title'];

mysql_query("INSERT INTO `pages` ('title','blurb') VALUES ('$title','$blurb') WHERE `pages_id` = '0'");
?>

<?php

try changing your SQL statement to this:

PHP:
mysql_query("INSERT INTO `pages` (`title`, `blurb`) VALUES ('$title', '$blurb') WHERE `pages_id` =  '0'");

use ` around table/field names and ' around the data you're inserting
 
Top