1
DarkDeath
In need of some PHP Script help!!!!!!!
  • 2003/10/8 19:20

  • DarkDeath

  • Just popping in

  • Posts: 29

  • Since: 2002/8/17


I want to post articles essentially. I want to make a template (already done) and make a nice interface where someone can type in different sections of info into a form and then the php will store all that in a database and display it in my template. Now thats not the hard part really. I also need it to be able to list the LAST few articles, as well as keep a FULL database listing of articles to pull up. The REALLY tricky part is i want to know if its possible to have ALL this on ONE php file. Have the ONE file display the data as the links are clicked in the SAME page.

I know its possible with fnctions like.. uhh the Switch function and stuff. However my brain is overloaded and i cant seem to figure it out. Can SOMEONE please help me!

I know i need to create some tables in my database...one for each section ofr the form i want to place in my template. Essentially i need someone to tell me how to take the form output..insert all those into their own tables in the database. Then recall those tables in my template, and THEN list others at the bottom as links. THen when those links are clicked it displays that info in my template.

HELP!!!!!!!!!!!!!!!!!!!!

2
DarkDeath
Re: In need of some PHP Script help!!!!!!!
  • 2003/10/9 16:47

  • DarkDeath

  • Just popping in

  • Posts: 29

  • Since: 2002/8/17


21 Views...... and NO replies!

Comeone peeps..help me lol.

3
DarkDeath
Re: In need of some PHP Script help!!!!!!!
  • 2003/10/10 1:02

  • DarkDeath

  • Just popping in

  • Posts: 29

  • Since: 2002/8/17


Yeh...did it myself....

4
Mithrandir
Re: In need of some PHP Script help!!!!!!!

See, it wasn't all that hard

Sorry for not helping you, but missed your post in the day it was up before you had it figured out.

For future problems, I'd recommend looking in the php manual. It has helped me a LOT and is found on http://www.php.net

If you are stuck still after searching the manual, by all means ask us But give us a bit of time to reply. If you also have a test site where we can see the form or how the problem looks, it's usually a great help.

Good luck forward

5
DarkDeath
Re: In need of some PHP Script help!!!!!!!
  • 2003/10/12 13:34

  • DarkDeath

  • Just popping in

  • Posts: 29

  • Since: 2002/8/17


A REPLY!!!! Wow.. ive only posted question on fex like 50 times and gotten nothin... this is exciting lol. LAst time i had a problem Herko was kewl enough to talk to me on MSN to fix my problems.

ANYWAY i got the script stuff i needed and made it work with alot of outside help. Essentially my code displays the database how i want it and all taht stuff... but im having trouble with the form to write TOO the database.

I am running two files...
here is the html file i run to display my form...
<FORM action="http://thisgeneration.com/modules/cjaycontent/content/encounters_form.php" method="POST">

<
table>
<
tr><td align="right">Script Titletd><td><input type="text" name="script_title">td>tr>
<
tr><td align="right">Scripttd><td><input type="text" name="script">td>tr>
<
tr><td align="right">Content Titletd><td><input type="text" name="content_title">td>tr>
<
tr><td align="right" valign="top">Contenttd><td><textarea name="content" rows="10" cols="50">textarea>td>tr>
table>

<
input type="submit" name="submit" value="submit"> <input type="reset" value="reset">
FORM>


and here is that php file that should make my form write to the database...
$dbname "thisgene_sitearticles";            // Place the database name here
$tablename "encounters";                // Table name here

$dbconnect mysql_connect ("localhost""thisgene_porter""password") or die(mysql_error());

$db = @mysql_select_db($dbname$dbconnect);

$sql "INSERT INTO $tablename (script_title, script, content_title, content) VALUES ('$_POST[script_title]', '$_POST[script]', '$_POST[content_title]', '$_POST[content]')";

$result = @mysql_querry($sql$dbconnect) or die(mysql_error());

?>


Any ideas WHY its not working.. i mean when i subit my form i get a blank white page... like it worked.. but it doesnt write it to my database.

6
Mithrandir
Re: In need of some PHP Script help!!!!!!!

instead of
$dbname "thisgene_sitearticles";            // Place the database name here
$tablename "encounters";                // Table name here

$dbconnect mysql_connect ("localhost""thisgene_porter",
"password") or die(mysql_error());

$db = @mysql_select_db($dbname$dbconnect);

$sql "INSERT INTO $tablename (script_title, script, content_title, content) VALUES
('
$_POST[script_title]', '$_POST[script]', '$_POST[content_title]',
'
$_POST[content]')";

$result = @mysql_querry($sql$dbconnect) or die(mysql_error());

?>

try this:
$sql "INSERT INTO ".$xoopsDB->prefix("encounters")." (script_title, script, content_title, content) VALUES
('
$_POST[script_title]', '$_POST[script]', '$_POST[content_title]',
'
$_POST[content]')";

$result $xoopsDB->query($sql) or die(mysql_error());

There is a database class and object ready to use - might as well use that

If it ain't working, try enabling first PHP debug and if no errors, then MySQL debug and see, where the problem is

GL

7
DarkDeath
Re: In need of some PHP Script help!!!!!!!
  • 2003/10/13 1:58

  • DarkDeath

  • Just popping in

  • Posts: 29

  • Since: 2002/8/17


well i cant do that casue im running thisstuff on a DIFF databse then i run XOOPS from.

8
Mithrandir
Re: In need of some PHP Script help!!!!!!!

oh, ok...well... your choice then

9
DarkDeath
Re: In need of some PHP Script help!!!!!!!
  • 2003/10/16 20:16

  • DarkDeath

  • Just popping in

  • Posts: 29

  • Since: 2002/8/17


LOL.. my problem was i wrote "querry" when i needed to put "query" MAN... lol

Login

Who's Online

245 user(s) are online (138 user(s) are browsing Support Forums)


Members: 0


Guests: 245


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits