Jump to content

No error, but broken script...


Alex-Grim

Recommended Posts

Well, this was going fine until i changed the $sql from a select statement to an insert statement. Now i get a blank page, and no errors. As you can tell, i'm new (straight from .Net). Here's my code:

<?php
error_reporting(E_ALL);

$host="localhost";
$user="webuser";
$pwd="666";
$dbname="AlexGrim";
$sql="insert into Contents ('pagename','pagetitle','pageprev','pagenext','pagedate','pagecontent')values($_POST['pagename'],$_POST['pagetitle'],$_POST['pageprev'],$_POST['pagenext'],'',$_POST['pagecontent'])";

include_once('sql.php');

$sql2="select * from Content";
include_once('sql2.php');
?>

 

And here's the included file:

<?php
echo "<br/><br/>Beginning of sql include<br/><br/>";

if (!$link = mysql_connect($host, $user, $pwd)) {
    echo 'Could not connect to mysql' . mysql_error();
    exit;
}

if (!mysql_select_db($dbname, $link)) {
    echo 'Could not select database' . mysql_error();
    exit;
}

$result = mysql_query($sql, $link);

if (!$result) {
    echo "DB Error, could not query the database\n";
    echo 'MySQL Error: ' . mysql_error();
    exit;
}
echo "<br/><br/>End of sql include<br/><br/>";

?> 

Link to comment
Share on other sites

Yeah, i seen that after i posted this, but that's not the problem, it get's stopped before the second query, and besides, i have it commented out for now:

<?php
error_reporting(E_ALL);

$host="localhost";
$user="webuser";
$pwd="666";
$dbname="AlexGrim";
$sql="select * from Contents";
//insert into Contents ('pagename','pagetitle','pageprev','pagenext','pagedate','pagecontent')values($_POST['pagename'],$_POST['pagetitle'],$_POST['pageprev'],$_POST['pagenext'],'',$_POST['pagecontent'])";

include_once('sql.php');

//$sql2="select * from Contents";
//include_once('sql2.php');
?>

 

Thanx

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.