Jump to content

Frank100

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Frank100's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi and thx for reply, yes, I'd need help with a code please, which would be a sample for me how the code is to achive to get a .htm where each field of the table is represented as an input field in the .htm. Also using the column names and using the widthand field_type infos from the mysql_table content to define the width of each html input_field and field_type. www.hfpz.net/support/php/auto_input_table/city_table_01.jpg www.hfpz.net/support/php/auto_input_table/city_table_01.sql
  2. Thx for the replys, haven't thought that a input can be so very complicated for a newbie. Thx Matto, I've tried out : $result = mysqli_query($cxn,$query) or die("<tt>Couldn't execute insert query. Reason: " . mysqli_error() . "</tt>"); and the result is : Warning: mysqli_error() expects exactly 1 parameter, 0 given in /var/www/vhosts/lodgecity.com/work/test_input_initial_process_01_02.php on line 27 Couldn't execute insert query. Reason: the database is defined with : $user="root"; $host="localhost"; $password=""; $database = "test"; $cxn = mysqli_connect($host,$user,$password,$database) or die ("Couldn't connect to server");
  3. The output always is : name is alf email is alf@alf.com phone is 310.222-3333 income is 200 Couldn't execute insert query "The form file" <html> <body> Fill out test data "test/table_01"<p> <form name="form1" method="POST" action="test_input_initial_process_01_02.php"> name: <input type="text" name="name"><p> email: <input type="text" name="email"><p> phone: <input type="text" name="phone"><p> income: <input type="text" name="income"><p> <input type="submit" name="Submit" value="Submit"> </form> </body> </html> "The processor file" <?php $user="root"; $host="localhost"; $password=""; $database = "test"; $cxn = mysqli_connect($host,$user,$password,$database) or die ("Couldn't connect to server"); $name = $_POST["name"]; $email = $_POST["email"]; $phone = $_POST["phone"]; $income = $_POST["income"]; $now = date("Y-m-d"); print "name is $name<br>\n"; print "email is $email<br>\n"; print "phone is $phone<br>\n"; print "income is $income<br>\n"; $query = "insert into test.table_01 (name, email, phone, income, signup_date, last_access) values ('$name', '$email', '$phone', '$income', '$now', '$now')"; $result = mysqli_query($cxn,$query) or die ("Couldn't execute insert query"); if ($result) { print <<<EOT Inserting successfull ! EOT; } else { print "Inserting went wrong !"; } mysqli_close($cxn); ?>
  4. thx for your reply, do you have a code sample how to get this to work to create a table ? I've researched google but was not able to find any. Frank
  5. thx for the replies, so when I understand right in the following sample $qry is not creating a variable because it creates a resource that immediately is executed ? <?php $qry =mysql_query("SELECT * FROM `staff` WHERE `clue` > 0"); echo mysql_num_rows($qry); ?>
  6. Question, is the connection done with the following $cxn already ? Or is this just defining a variable which will be executed later in the $result ? If just a variable definition, how would I execute $ result ? $cxn = mysqli_connect($host,$user,$password,$database) or die ("Couldn't connect to server"); $result = mysqli_query($cxn,$query) or die ("Couldn't execute insert query"); Regards, Frank
  7. Hi, is there a way in php to look up a mysql table and use the column headings as form field variables … meaning with this php program the entire table columns are displayed as form fields in the browser ? No need then to build the form by hand … in this consequence there could be a input type column and a width column which could be used to also automatically create the right types of fields for that particular mysql table … Regards, Frank hdu43hd
  8. ups ... which one would be the right board please ?? Also, why does my auto e-mail respond doesn't send e-mails when I get an answer ?? Regards, Frank
  9. got it ... the user didn't have the permission to write.
  10. Hi, I’ve checked 2 books and 3 web tutorials on this, but the data still wouldn’t add to my customer table ... who can give me a hint what’s wrong. Here is the html form file <html> <body> Fill out to insert to table "customer"<p> <form name="form1" method="get" action="newcustomer.php"> Name: <input type="text" name="name"><p> Email address: <input type="text" name="email"><p> <input type="submit" name="Submit" value="Submit"> </form> </body> </html> Here is the process.php file <html><title>Simple Insert ...</title> <body> <?php $name = $_GET["name"]; $email = $_GET["email"]; $now = date("Y-m-d"); print "Name is $name<br>\n"; print "Email is $email<br>\n"; mysql_connect("localhost", "fhx", "dududu"); $result = mysql_query( "insert into phpbase.customer (name, email, signup, last_access) values ('$name', '$email', '$now', '$now')" ); if ($result) { print <<<EOT Inserting successfull ! EOT; } else { print "Inserting went wrong !"; } mysql_close(); ?> </body></html> This is my database www.hfpz.net/support/php/database_01.jpg
  11. have tried it again in different variations but have not enough knoledge to find out why it doesn't work ... does somebody know ? Regards, Frank
  12. Hi Andy, thx again ! I've tried it out but it seems that I still make a mistake ... no tables are created. Here's my whole .php file. Regards, Frank <?php /* connect database */ $link = mysqli_connect("localhost", "root", "abc", "test"); /* check connection */ if (!$link) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } // establish connection to database, select database, then ... $query = " CREATE TABLE placesx ( place_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , place_picture_01 VARCHAR(30) NOT NULL , place_picture_02 VARCHAR(30) NOT NULL ) ENGINE = innodb"; $result = mysql_query($query); // execute first query $query = " CREATE TABLE renterx ( renter_id INT(10) unsigned NOT NULL auto_increment primary key , renter_first_name VARCHAR(30) NOT NULL , renter_last_name VARCHAR(30) NOT NULL ) ENGINE = innodb"; $result = mysql_query($query); // execute second query ... /* check query */ if (mysqli_query($link, $query)=== TRUE) { printf("Table successfully created.\n"); } /* disconnect database */ mysqli_close($link); ?>
  13. Hi + thx for reply, sure, the comma has to go but how do I execute the queries separately in one p.p file ?
  14. Hi, when I try to create 2 tables through a .php file like this it doesn’t work. Can somebody give me a hint ? It’s only the 2 querys which make problems, the rest of the file (not shown here) works … when I use just 1 query the .php file works fine and creates the desired table. Regards, Frank $query = " CREATE TABLE company ( company_id INT(10) unsigned NOT NULL auto_increment primary key , company_registerdate TIMESTAMP NOT NULL ) ENGINE = innodb"; $query = " CREATE TABLE lessor ( lessor_id INT(10) unsigned NOT NULL auto_increment primary key , lessor_registerdate TIMESTAMP NOT NULL , ) ENGINE = innodb";
×
×
  • 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.