Jump to content

dark k58

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dark k58's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. yah I've already added that before, I don't know why but i got no errors
  2. I know, I used the same code on my other website but with different fields and it works
  3. no i got no error messages, everything goes perfectly but i can't see any data in the database i added that still not working
  4. I got this code for a register page, it worked in my other website but when i copied it and edited the fields on my new website, it shows no errors but no data it being inserted in the database it does say that the registration is successful, please help thanks this is the code: <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ?> <?php // Connect to the MySQL database include "../storescripts/connect_to_mysql.php"; //This code runs if the form has been submitted if (isset($_POST['submit'])) { //This makes sure they did not leave any fields blank if (!$_POST['firstname'] | !$_POST['surname'] | !$_POST['business_name'] | !$_POST['address1'] | !$_POST['city'] | !$_POST['postcode'] | !$_POST['telephone_number'] | !$_POST['mobile_number'] | !$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] | !$_POST['email'] ) { header("location: register_user_fail.php"); exit(); } // checks if the username is in use if (!get_magic_quotes_gpc()) { $_POST['username'] = addslashes($_POST['username']); } $usercheck = $_POST['username']; $check = mysql_query("SELECT username FROM user WHERE username = '$usercheck'") or die(mysql_error()); $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { header("location: username_is_used.php"); exit(); } // this makes sure both passwords entered match if ($_POST['pass'] != $_POST['pass2']) { header("location: password_don't_match.php"); exit(); } // now we insert it into the database $insert = "INSERT INTO user (firstname, surname, business_name, address1, address2, address3, postcode, city, telephone_number, mobile_number, username, password, email) VALUES ('".$_POST['firstname']."', '".$_POST['surname']."', '".$_POST['business_name']."', '".$_POST['address1']."', '".$_POST['address2']."', '".$_POST['address3']."', '".$_POST['postcode']."', '".$_POST['telephone_number']."', '".$_POST['mobile_number']."', '".$_POST['username']."', '".$_POST['pass']."', '".$_POST['email']."')"; $add_member = mysql_query($insert); ?> <?php header("location: register_success.php"); exit(); ?> <?php } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>User Register</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen" /> </head> <body> <div align="center" id="wrapper"> <?php include_once("user_login_template_header.php");?> <div id="content"> <table width="100%" border="0" cellspacing="0" cellpadding="10"> <tr> <td width="32%" valign="top"> </td> <td width="35%" valign="top"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table border="0"> <tr><td>First Name:</td><td> <input type="text" name="firstname" maxlength="60"> </td></tr> <tr><td>Surname:</td><td> <input type="text" name="surname" maxlength="60"> </td></tr> <tr><td>Business Name:</td><td> <input type="text" name="business_name" maxlength="60"> </td></tr> <tr><td>Address 1:</td><td> <input type="text" name="address1" maxlength="60"> </td></tr> <tr><td>Address 2:</td><td> <input type="text" name="address2" maxlength="60"> </td></tr> <tr><td>Address 3:</td><td> <input type="text" name="address3" maxlength="60"> </td></tr> <tr><td>Postcode:</td><td> <input type="text" name="postcode" maxlength="9"> </td></tr> <tr><td>City:</td><td> <input type="text" name="city" maxlength="60"> </td></tr> <tr><td>Telephone Number:</td><td> <input type="text" name="telephone_number" maxlength="12"> </td></tr> <tr><td>Mobile Number:</td><td> <input type="text" name="mobile_number" maxlength="12"> </td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="60"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="25"> </td></tr> <tr><td>Confirm Password:</td><td> <input type="password" name="pass2" maxlength="25"> </td></tr> <tr><td>Email:</td><td> <input type="email" name="email" maxlength="60"> </td></tr> <tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table> </form> <br /> </p> <p><br /> </p></td> <td width="33%" valign="top"> </td> </tr> </table> </div> <?php include_once("../footer.php");?> </div> </body> </html> <?php } ?>
  5. ok I made a contact us page where the user has to enter his email and message to send it this is the code for the contact us page <?php include "../storescripts/user_php_login.php"; ?> <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact Page</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen" /> </head> <body> <div align="center" id="wrapper"> <?php include_once("template_header_user_login.php");?> <div id="content"> <table width="100%" border="0" cellspacing="0" cellpadding="10"> <tr> <td width="32%" valign="top"><form method="post" action="../storescripts/contact.php"> Email: <input name="email" type="text"><br> Message:<br> <textarea name="message" rows="15" cols="40"></textarea><br> <input type="submit"> </form> </td> <td width="35%" valign="top"></td> <td width="33%" valign="top"></td> </tr> </table> </div> <?php include_once("template_footer_user_login.php");?> </div> </body> </html> and this is the php that sends the message <?php $to = "abdulrab09@ymail.com"; $subject = "Contact Us"; $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> I want it so when the user is logged in it would bull his email from the database so he doesn't need to enter it so all he does is write the message and click send thankyou
  6. this is a link to the page I'm trying to make it will display all the data and I want it to display the image on the left http://www.abdulrablahson.com/storeuser/productsearch.php
  7. ok I uploaded images in a folder in my directory and uploaded the image detail to mysql database, the image has the same name as the id so if the id = 1 the image will be named 1.jpg this code is made for a search bar, so i would have a search bar in a separate page which link to this all my product will be listed here and when someone searches for a product it will show them only the spesific product they searched for my problem is i can't get the image up the so please help me thank you this is the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Store Admin Area</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen" /> </head> <body> <div align="center" id="wrapper"> <?php include_once("template_header_user_login.php");?> <div id="content"> <?php include "../storescripts/connect_to_mysql.php"; $term = $_POST['term']; $sql = mysql_query("select * from products where product_name like '%$term%' or price like '%$term%' or details like '%$term%' or category like '%$term%' or subcategory like '%$term%' or date_added like '%$term%'"); while ($row = mysql_fetch_array($sql)){ echo "<table>"; echo "<tr>"; echo "<td>"; echo 'ID: '.$row['id']; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>" ; echo '<br/> Product Name: '.$row['product_name']; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo '<br/> Price: £ '.$row['price']; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo '<br/> Detail: '.$row['details']; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo '<br/> Category: '.$row['category']; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo '<br/> SubCategory: '.$row['subcategory']; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo '<br/> Date Added: '.$row['date_added']; echo "</td>"; echo "</tr>"; echo '<br/><hr><br/>'; echo "</tr>"; echo "</table>"; } ?> </div> <?php include_once("template_footer_user_login.php");?> </div> </body> </html> this is the search bar code <form action="search.php" method="post"> Search: <input type="text" name="term" /><br /> <input type="submit" name="submit" value="Submit" /> </form> more detail: I want it to select the image with the same id as the product and import it I was able to do that while using php url, but i didn't know how to do it here please help thanks
  8. I need to do it on php, that code calls 10 items from database and images from my file and makes a url using .php?id="id" I was told to use this code : $x = 0; echo "<table><tr>"; $result=mysql_query("SELECT * TABLE"); while ( $row=mysql_fetch_assoc($result) ) { echo "<td>" . $row['field']. "</td>"; $x++; $y = $x / 4; if(is_float($y)){ echo "</tr><tr>"; } } echo "</tr></table>"; but I don't know how/where to add it to my code, so can some one help me with that thanks
  9. ok I made it so that in my index page it would list 10 items from my gallery database but the items are on top of each other e.g.: item1 item 2 item3 etc... I want to be able to orgnise it so it would be like: item 1 item 2 item 3 item 4 item 5 item 6 item 7 etc... this is my index page where all my data will show(index.php): <?php error_reporting(E_ALL); ini_set('display_errors', '0'); ?> <?php // Run a select query to get my letest 6 items // Connect to the MySQL database include "script/connect_to_mysql.php"; $dynamicList = ""; $sql = mysql_query("SELECT * FROM gallery ORDER BY id DESC LIMIT 10"); $imageCount = mysql_num_rows($sql); // count the output amount if ($imageCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $dynamicList .= '<table width="1050px" border="0" cellspacing="0" cellpadding="6" bgcolor="#FFFF99" cellpadding="150"> <tr> <td width="17%" valign="top"><a href="gallery.php?id=' . $id . '"><img style="border:#666 1px solid;" src="gallery_images/' . $id . '.jpg" alt="' . image_name . '" width="77" height="102" border="1" /></a></td> </tr> </table>'; } } else { $dynamicList = "We have no images listed in our store yet"; } mysql_close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Store Home Page</title> <link rel="stylesheet" href="style/style.css" type="text/css" media="screen" /> </head> <body> <div align="center" id="mainWrapper"> <?php include_once("template_header.php");?> <div id="pageContent"> <p><?php echo $dynamicList; ?> </div> <?php include_once("template_footer.php");?> </div> </body> </html> and this is the page where my data is viewwed i think (gallery.php): <?php // This file is www.developphp.com curriculum material // Written by Adam Khoury January 01, 2011 // http://www.youtube.com/view_play_list?p=442E340A42191003 // Script Error Reporting error_reporting(E_ALL); ini_set('display_errors', '1'); ?> <?php // Check to see the URL variable is set and that it exists in the database if (isset($_GET['id'])) { // Connect to the MySQL database include "script/connect_to_mysql.php"; $id = preg_replace('#[^0-9]#i', '', $_GET['id']); // Use this var to check to see if this ID exists, if yes then get the product // details, if no then exit this script and give message why $sql = mysql_query("SELECT * FROM gallery WHERE id='$id' LIMIT 1"); $imageCount = mysql_num_rows($sql); // count the output amount if ($imageCount > 0) { // get all the product details while($row = mysql_fetch_array($sql)){ $image_name = $row["image_name"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); } } else { echo "That item does not exist."; exit(); } } else { echo "Data to render this page is missing."; exit(); } mysql_close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo $image_name; ?></title> <link rel="stylesheet" href="style/style.css" type="text/css" media="screen" /> </head> <body> <div align="center" id="wrapper"> <?php include_once("template_header.php");?> <div id="content"> <table width="100%" border="0" cellspacing="0" cellpadding="15"> <tr> <td width="30%" valign="top"><h3><?php echo $image_name; ?></h3><hr> </tr></table> <table width="100%" border="0" cellspacing="0" cellpadding="15"> <td width="80%" height="50%" valign="top"><img src="gallery_images/<?php echo $id; ?>.jpg" width="800" height="500" align="left" alt="<?php echo $image_name; ?>" /><br /> </td> <br /> </tr> </table></br> <table> <td> <a href="gallery_images/<?php echo $id; ?>.jpg">View Full Size Image</a> </td> </table> </div> <?php include_once("template_footer.php");?> </div> </body> </html> I did some research and I know I'm suppose to use a code like this to make it work but I'm still a beginner and I don't really know how to implement it so please help: $x = 0; echo "<table><tr>"; $result=mysql_query("SELECT * TABLE"); while ( $row=mysql_fetch_assoc($result) ) { echo "<td>" . $row['field']. "</td>"; $x++; $y = $x / 4; if(is_float($y)){ echo "</tr><tr>"; } } echo "</tr></table>"; thankyou
  10. ok to make it easy I will show you the list of pages you need 1s page would be the one that views the list of products (assuming there are products in your database) I've added a line of code to connect the database you just have to change it to your own database. make sure you read the notes i put on the code <?php //this will include the second page so that you can connect to the mysql database, change it to what ever you going to call the second page include "the second page here.php"; // This block grabs the whole list for viewing, here you have to change the table name, I've already changed it to the one you gave me , don't change the "$product_list" $product_list = ""; $sql = mysql_query("SELECT * FROM hdmikabels ORDER BY date_added DESC"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { while($row = mysql_fetch_array($sql)){ //here you will list the columns (make sure you change them to the same column names in your database table) $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); //this is going to be how the data is viewed, don't change the "$product_list" $product_list .= "Product ID: $id - <strong>$product_name</strong> - $$price - <em>Added $date_added</em><br />"; } } else { $product_list = "You have no products"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <div> <!-- this here will view the sql data on your site --> <?php echo $product_list; ?> </div> </body> this is going to be the second page so you can connect to the database <?php /* 1: "die()" will exit the script and show an error statement if something goes wrong with the "connect" or "select" functions. 2: A "mysql_connect()" error usually means your username/password are wrong 3: A "mysql_select_db()" error usually means the database does not exist. */ // Place db host name. Sometimes "localhost" but // sometimes looks like this: >> ???mysql??.aserver.net $db_host = "your.host.com"; // Place the username for the MySQL database here $db_username = "database_username"; // Place the password for the MySQL database here $db_pass = "password"; // Place the name for the MySQL database here $db_name = "the name of the database here"; // Run the actual connection here, don't change this mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql"); mysql_select_db("$db_name") or die ("no database"); ?>
  11. This is a code from a site i did: <?php // This block grabs the whole list for viewing $product_list = ""; $sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { while($row = mysql_fetch_array($sql)){ //here you will list the columns $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); //this is going to be how the data is viewed $product_list .= "Product ID: $id - <strong>$product_name</strong> - $$price - <em>Added $date_added</em><br />"; } } else { $product_list = "You have no products"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <div> <!-- this here will view the sql data on your site --> <?php echo $product_list; ?> </div> </body>
  12. the x axis, y axis and z axis all have their separate tables
  13. hi I want to make a chart of the data stored in my phpmyadmin and and post it on the website I have no Idea how to do this so if someone does please help me thankyou
  14. I used this code in my registration page but I allways get these errors and the user is not created in my database can anyone help me to get this code to work this is the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="description" content="we show most of Mark padua's work" /> <meta name="keywords" content="gallery,painting discription,history of artist" /> <meta name="artistr" content="Mark padua" /> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Mark's gallery</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> </div> <div id="wrapper"> <div id="header"></div> <div id="menu"> <p><a href="index.html">Homepage</a><a href="Gallery.html">Gallery</a><a href="Contactus.html">Contact us</a><a href="register.php"> Register</a><a href="login.html">Login</a></p> </div> <div id="content"></div> <form method=post action=register.php?action=register name=s> <table> <tr><td>Username:</td><td><input type=text name=user></td></tr> <tr><td>Email:</td><td><input type=text name=email></td></tr> <tr><td>Password:</td><td><input type=password name=pass></td></tr> <tr><td>Verify Pass:</td><td><input type=password name=vpass></td></tr> <tr><td colspan=2 align=center><input type=submit value=Register></td></tr> </table> </form> <?php //Login to your database. Make the fields of course.. mysql_connect("attractivegallery.net","dark k58","************"); mysql_select_db("user"); //end //if registering, fields. if ($action == register) { if (!$user || !$pass || !$email || !$vpass) { print "You must fill out all fields."; exit; } $dupe1 = mysql_num_rows(mysql_query("select * from table where user='$user'")); if ($dupe1 > 0) { print "Someone already has that username."; exit; } $dupe2 = mysql_num_rows(mysql_query("select * from table where email='$email'")); if ($dupe2 > 0) { print "Someone already has that email."; exit; } //check if passwords are the same if ($pass != $vpass) { print "The passwords do not match."; exit; } //end //insert mysql_query("insert into table (user, email, pass) values('$user','$email','$pass')"); print "You are now registered. Login."; } ?> <div id="footer"></div> </div> </body> </html>
×
×
  • 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.