»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 08-13-2003, 11:30 AM   #1 (permalink)
DKY
Registered User
 
Join Date: Jun 2003
Posts: 34
DKY is on a distinguished road
Send a message via ICQ to DKY Send a message via AIM to DKY Send a message via Yahoo to DKY
getting a form to make a table in mysql

here's what I'm trying to do, I'm trying to get a form to make a table in sql. I can't seem to get it though.

Here's what I got
PHP Code:
<html><head><title></title></head><body>
<?php
$host                       
"localhost";
$user                       "name";
$password                   "password";
$database                   "rhs_catalog";
$cantconnectmysqlmessage    "I can't connect to MySQL!!";
$cantconnectdatabasemessage "I can't connect to the database!!";
$cantmaketablemessage       "I can't make a table in the database!!";
$connectmysql               mysql_connect($host,$user,$password) or die ($cantconnectmysqlmessage);
$db                         mysql_select_db($database,$connectmysql) or die ($cantconnectdatabasemessage);
?>
<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="newsentry">
<CENTER>
   <P ALIGN=CENTER>
    <TABLE WIDTH="600" bordercolor="black" CELLPADDING="0" CELLSPACING="0" BORDER="0">
     <TR>
        
     <TD style="border-bottom-style: solid; border-bottom-width:1"
style="border-right-style: solid; border-right-width: 1"
style="border-top-style: solid; border-top-width:1"
style="border-left-style: solid; border-left-width: 1"
WIDTH="100%" BGCOLOR="#F1F1F1"
VALIGN=center>&nbsp;this is the table name</TD>
     </TR>
     <TR>
      
     <TD WIDTH="100%" VALIGN=TOP><p>
<textarea  name="category" cols="75" rows="1" wrap></textarea>
</p></TD>
     </TR>
         </TABLE>
<p>
<input type="submit" name="Submit" value="Save Changes">
</p>
</form>
<?
$category       
$_POST["category"];
$category       stripslashes($category);
$nametablequery "CREATE TABLE $category";
$nametable      mysql_query($nametablequery) or die($cantmaketablemessage);


$disconnectmysql            mysql_close($connectmysql);?>
</body></html>
its giving me the form, with the save changes button, but it gives me the "can't make table" error right underneath it. Anyone know how to fix this, or what I'm doing wrong?


Last edited by DKY; 08-14-2003 at 07:35 AM.
DKY is offline   Reply With Quote
Old 08-13-2003, 10:01 PM   #2 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
qball is on a distinguished road
just comment out:

Quote:
$cantmaketablemessage = "I can't make a table in the database!!";
what is the value of:

$category

when you execute SQL statement?
qball is offline   Reply With Quote
Old 08-14-2003, 07:38 AM   #3 (permalink)
DKY
Registered User
 
Join Date: Jun 2003
Posts: 34
DKY is on a distinguished road
Send a message via ICQ to DKY Send a message via AIM to DKY Send a message via Yahoo to DKY
I'm trying to get the value of category to be whatever I put in the textarea. And I would like the error message to appear if it cant make the database after I submit the form. instead it appears at the bottom of the form when I havent even submitted the form yet.
DKY is offline   Reply With Quote
Old 08-14-2003, 10:24 PM   #4 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
qball is on a distinguished road
Quote:
instead it appears at the bottom of the form when I havent even submitted the form yet.
not possible. data cannot exist in form not submitted.

answer my questions, or figure out $_self?

Quote:
what is the value of:
$category
when you execute SQL statement?
ok, just post SQL???
qball is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 11:51 PM.