473,326 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Need Help with php and Mysql

I am trying to create a data base for colleting date for my research
project. I have run in to a couple of problems and I need it fast ASAP I
need it to be able to add data and edit them and view the data form a public
site. I have not use mysql and php since 2003 I have created the date base
with 2 tables 1 for a Jump Menu and on for the content. The contents is in
a table called PR and I as soon as I enter the data and hit submit the web
brower go blank.
mysql> desc PR;
+-------------+--------------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+------------+----------------+
| ID | tinyint(4) | | PRI | NULL | auto_increment |
| Title | longtext | | | | |
| Pubilcation | varchar(255) | YES | | | |
| Date | date | | | 0000-00-00 | |
| Edition | varchar(10) | | | | |
| Section | varchar(10) | | | | |
| Page | varchar(10) | | | | |
| AUTHOR | longtext | | | | |
| Source | longtext | | | | |
| Body | longtext | | | | |
+-------------+--------------+------+-----+------------+----------------+
10 rows in set (0.06 sec)

mysql>
The Other is Media it look like this
+-----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+----------------+
| id | tinyint(3) | | PRI | NULL | auto_increment |
| Company | varchar(40) | | | | |
| Mediatype | varchar(6) | | | | |
| url | varchar(255) | | | | |
+-----------+--------------+------+-----+---------+----------------+

I created a include called config.php
Which look like this

<?php
$mysql_host ='localhost';
$mysql_user= 'jdmonc';
$mysql_pass = '5373988';
$mysql_database = 'HRC'
?>

_____
The add-news function look like this. <body>
<form Action="libary/postnews.php" Method="post">
<table width="90%" border="5" cellspacing="2" cellpadding="2">
<tr>
<td width="8%"> <h3>Title</h3></td>
<td width="92%"> <textarea name="Title" cols="78"
id="Title"></textarea></td>
</tr>
<tr>
<td> <h3>Pubilcation</h3></td>
<td> <select name="Pubilcation" id="Pubilcation">
</select></td>
</tr>
<tr>
<td> <h3>Edition</h3></td>
<td> <select name="Edition" id="Edition"
onChange="MM_jumpMenu('parent',this,0)">
<option value="Final">Final</option>
</select></td>
</tr>
<tr>
<td> <h3>Date</h3></td>
<td> <input name="Date" type="text" id="Date" size="20">
(YYYY-MM-DD)</td>
</tr>
<tr>
<td> <h3>Section</h3></td>
<td> <input name="Section" type="text" id="Section" size="15"></td>
</tr>
<tr>
<td width="8%"> <h3>Page</h3></td>
<td> <input name="Page" type="text" id="Page"></td>
</tr>
<tr>
<td> <h3>By</h3></td>
<td> <input name="AUTHOR" type="text" id="by" size="20"
maxlength="40"></td>
</tr>
<tr>
<td> <h3>Source</h3></td>
<td> <input name="Source" type="text" id="Source"></td>
</tr>
<tr>
<td> <h3>BODY</h3></td>
<td> <textarea name="Body" cols="78" rows="78" wrap="OFF"
id="Body"></textarea></td>
</tr>
<tr>
<td> <h3>&nbsp;</h3></td>
<td> <input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
<html>
_______

Postnews.php

?php
///Connect to database Server
include ('config.php')
$connection = mysql_connect($mysql_host,$mysql_user,$mysql_pass)
or die ("unable to connecct")
//Select Database
mysql_select_db ($myaql_database,$connection)
or die ("Unable to select Database")
echo "test"
$query = "INSERT INTO PR (Title, Pubilcation, Date, Edition, Section,
Page, AUTHOR, Source, Body".
" VALUES ('', $_POST["Title"], $_POST["Pubcation"], $_POST["Date"],
$_POST["Edition"], $_POST["Section"], $_POST["Page"], $_POST["AUTHOR"],
$_POST["Source"],$_POST[Body]));
//$result = mysql_qurey($query);
echo $query;
include 'closedb.php'
/?>


Aug 13 '05 #1
2 1582
hello,

i took a quick look at the code, and it seems the problem is a typo
in postnews.php you've typed

mysql_select_db ($myaql_database,$connection)
instead of mysql_select_db ($mysql_database,$connection)

The is the most common error that happens when writing code :)

Have a great day.

Aug 14 '05 #2
Jeffrey D Moncrieff wrote:
I am trying to create a data base for colleting date for my research
project. I have run in to a couple of problems and I need it fast ASAP I
need it to be able to add data and edit them and view the data form a public
site. I have not use mysql and php since 2003 I have created the date base
with 2 tables 1 for a Jump Menu and on for the content. The contents is in
a table called PR and I as soon as I enter the data and hit submit the web
brower go blank.
mysql> desc PR;
+-------------+--------------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+------------+----------------+
| ID | tinyint(4) | | PRI | NULL | auto_increment |
| Title | longtext | | | | |
| Pubilcation | varchar(255) | YES | | | |
| Date | date | | | 0000-00-00 | |
| Edition | varchar(10) | | | | |
| Section | varchar(10) | | | | |
| Page | varchar(10) | | | | |
| AUTHOR | longtext | | | | |
| Source | longtext | | | | |
| Body | longtext | | | | |
+-------------+--------------+------+-----+------------+----------------+
10 rows in set (0.06 sec)

mysql>
The Other is Media it look like this
+-----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+----------------+
| id | tinyint(3) | | PRI | NULL | auto_increment |
| Company | varchar(40) | | | | |
| Mediatype | varchar(6) | | | | |
| url | varchar(255) | | | | |
+-----------+--------------+------+-----+---------+----------------+

I created a include called config.php
Which look like this

<?php
$mysql_host ='localhost';
$mysql_user= 'jdmonc';
$mysql_pass = '5373988';
$mysql_database = 'HRC'
?>

_____
The add-news function look like this. <body>
<form Action="libary/postnews.php" Method="post">
<table width="90%" border="5" cellspacing="2" cellpadding="2">
<tr>
<td width="8%"> <h3>Title</h3></td>
<td width="92%"> <textarea name="Title" cols="78"
id="Title"></textarea></td>
</tr>
<tr>
<td> <h3>Pubilcation</h3></td>
<td> <select name="Pubilcation" id="Pubilcation">
</select></td>
</tr>
<tr>
<td> <h3>Edition</h3></td>
<td> <select name="Edition" id="Edition"
onChange="MM_jumpMenu('parent',this,0)">
<option value="Final">Final</option>
</select></td>
</tr>
<tr>
<td> <h3>Date</h3></td>
<td> <input name="Date" type="text" id="Date" size="20">
(YYYY-MM-DD)</td>
</tr>
<tr>
<td> <h3>Section</h3></td>
<td> <input name="Section" type="text" id="Section" size="15"></td>
</tr>
<tr>
<td width="8%"> <h3>Page</h3></td>
<td> <input name="Page" type="text" id="Page"></td>
</tr>
<tr>
<td> <h3>By</h3></td>
<td> <input name="AUTHOR" type="text" id="by" size="20"
maxlength="40"></td>
</tr>
<tr>
<td> <h3>Source</h3></td>
<td> <input name="Source" type="text" id="Source"></td>
</tr>
<tr>
<td> <h3>BODY</h3></td>
<td> <textarea name="Body" cols="78" rows="78" wrap="OFF"
id="Body"></textarea></td>
</tr>
<tr>
<td> <h3>&nbsp;</h3></td>
<td> <input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
<html>
_______

Postnews.php

?php
///Connect to database Server
include ('config.php')
$connection = mysql_connect($mysql_host,$mysql_user,$mysql_pass)
or die ("unable to connecct")
//Select Database
mysql_select_db ($myaql_database,$connection)
or die ("Unable to select Database")
echo "test"
$query = "INSERT INTO PR (Title, Pubilcation, Date, Edition, Section,
Page, AUTHOR, Source, Body".
" VALUES ('', $_POST["Title"], $_POST["Pubcation"], $_POST["Date"],
I guess you're running in errors here. " VALUES ('', $_POST[" <-- oops string closed?!
some for the following $_POST["...
$_POST["Edition"], $_POST["Section"], $_POST["Page"], $_POST["AUTHOR"],
$_POST["Source"],$_POST[Body]));
//$result = mysql_qurey($query);
echo $query;
include 'closedb.php'
/?>


Aug 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pancho | last post by:
Greetings, I need help configuring/building PHP3 with MySQL as a DSO on a Solaris 8 box - this module is needed to host some existing sites I will be migrating Note. I built PHP4 from source and...
0
by: root | last post by:
hi there, I've tried to install mysql-3.23.55.tar.gz but failed. Firstly, I've created directory /home/users/mysql and add group for mysql. Those are the command that I've used previously: ...
0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
0
by: Creigh Shank | last post by:
Using an Apache/PHP/MySQL/Linux (Redhat 8.0) solution, PHPList, to create an e-mailing list for our 5.6 million book club members. Unfortunately, the import speed for importing records (at record...
6
by: NotGiven | last post by:
I have a db that I need to dump into a format that can be easily read my MS Access. I tried the dump with regular PHPAdmin. Then I used the dump to run a query in MS Access. Errors occurred...
1
by: zia | last post by:
Dear friends! I have decided to do my final Project in PHP and MySQL.Can Anybody plz tell me wether these Tools Will Support Distributed Databases. Aspecially MySQL. As some people says MySQL...
4
by: Spare Brain | last post by:
Hi, I recently installed SuSE 9.3 on x86, and it seems to contain scripts "apache2" and "mysql" in the /etc/init.d folder. However, these two (Apache or MySQL) are not running when I fresh...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
1
by: Dano | last post by:
OK, I'm officially frustrated. I had MySQL 4.0.18 running as a service on my WinXP laptop, along with MySQLAdministrator, and a new tool, DB Designer. Everything was working fine, and I was able...
21
by: nihad.nasim | last post by:
Hi there, I have a database in Access that I need on the web. The web page should connect to the database and write records for certain tables and view records for others. I want to know a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.