Jump to content

Jazza

Members
  • Posts

    22
  • Joined

  • Last visited

Jazza's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. What do you mean without static and if condition? Thanks
  2. Hi Thanks again for the reply. So if I use the form, instead of just entering the php code script in the browser, those errors will not be displayed? The data is not going into the database though. Thanks
  3. Hi, thanks for the reply. I forgot to add the HTML form. <html> <head> </head> <body> <form action="insertproduct.php" method="POST" enctype="multipart/form-data"> Title<input type="text" name="title"><br><br> Product Price<input type="number" name="price"><br><br> Stock remaining <select name="stock" id="stock"> <option value="in stock">In stock</option> <option value="almost out">Almost out</option> <option value="out of stock">Out of stock</option> </select><br><br> Select image 1: <input type="file" name="img1" multiple><br><br> Select image 2: <input type="file" name="img2" multiple><br><br> Select image 3: <input type="file" name="img3" multiple><br><br> Select image 4: <input type="file" name="img4" multiple><br><br> <hr> Product Description:<br><br><textarea rows="10" cols="100" name="description"> </textarea><br><br> <hr> Shipping Price($)<input type="number" name="postage"><br><br> Instore Pickup available? <input type="radio" name="pickup" value="yes" id="yes" checked> Yes <input type="radio" name="pickup" value="no" id="no"> No <br><br> <input type="submit" value="submit"> </form> </body> </html>
  4. Hi I am having trouble inserting data into my MySQL database. This is my PHP code ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); static $connection; if(!isset($connection)) { $connection = new mysqli("localhost","username","password"); } if ($connection->connect_error) { die("Connection failed: " . $connection->connect_error); } $stmt = $connection->prepare("INSERT into Product(product_title,product_price,product_availability,productImage_1,productImage_2,productImage_3,productImage_4,product_description,product_shipping,product_pickup) VALUES(?,?,?,?,?,?,?,?,?,?)"); $product_title = $_POST['title']; $product_price = $_POST['price']; $product_availability = $_POST['stock']; $null = NULL; $product_description = $_POST['description']; $product_shipping = $_POST['postage']; $product_pickup = $_POST['pickup']; $stmt->bind_param('sisbbbbsis',$product_title,$product_price,$product_availability,$null,$null,$null,$null,$product_description,$product_shipping,$product_pickup); $stmt->send_long_data(3, file_get_contents($_FILES['img1']['tmp_name'])); $stmt->send_long_data(4, file_get_contents($_FILES['img2']['tmp_name'])); $stmt->send_long_data(5, file_get_contents($_FILES['img3']['tmp_name'])); $stmt->send_long_data(6, file_get_contents($_FILES['img4']['tmp_name'])); $stmt->execute(); $stmt->close(); $connection->close(); echo "Product inserted successfully"; I am also getting these errors. Notice: Undefined index: title in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 61 Notice: Undefined index: price in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 62 Notice: Undefined index: stock in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 63 Notice: Undefined index: description in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 67 Notice: Undefined index: postage in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 68 Notice: Undefined index: pickup in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 69 Fatal error: Call to a member function bind_param() on boolean in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 71 Thanks in advance.
  5. Yes, however I prefer the icon's to be on the right side and the search field to be in the center.
  6. I forget to add it in, but I did put it now and the search field is still not in the right place.
  7. #navbar{ width:100%; height:50px; background-color:#D00000; } #logo{ width:90px; height:auto; margin-left:1%; margin-top:1%; margin-bottom:1%; float:left; border-style: solid; border-width:2px; } #navicons{ width:250px; height:50px; border-style:solid; border-width:1px; } .glyphicon.glyphicon-bell{ font-size:40px; padding-top:5px; padding-bottom:5px; color:#b0b0b0; } .glyphicon.glyphicon-comment{ font-size:40px; padding-top:5px; padding-bottom:5px; color:#b0b0b0; } #name{ width:auto; height:10px; }
  8. Hi. I am not to sure how to explain but I will try my best. I am trying to make a navigation bar and it will not all go on the 'navbar' id. <!DOCTYPE html><head><link rel="stylesheet" typ"text/css" href="css/bootstrap.css"><link rel="stylesheet" typ="text/css" href="css/mystyle.css"></head><body> <div id="navbar"> <div id="logo"> <p>hdfdf</p> </div> <div style="margin-left:750px;" id="navicons"> <span class="glyphicon glyphicon-bell" aria-hidden="true" style="padding-right:20px;"></span> <span class="glyphicon glyphicon-comment" aria-hidden="true" style="padding-right:20px;"></span> <p>Jazza</p> </div> <form class="form-horizontal" style="width:100px;"> <div class="form-group"> <label for="search" class="col-sm-2 control-label"></label> <input type="search" class="form-control" id="inputEmail3" placeholder="Search"> <button class="btn btn-success">Search</button> </div> </div></body></html> When the localhost process that code, the search field is below the navigation box and the name 'Jazza' is not to the right of the glyphicon's. It is all in the navbar div. Also, if you have a look at the attachment, that is what I am getting when I process the file. Thanks Jarrod
  9. Still no luck connecting.
  10. Hi I am trying to connect to a mysql database through phpmyadmin. I have followed the steps in this video and still no luck. This is my code; <?phpDEFINE ('DB_USER' , 'jazza' );DEFINE ('DB_PSWD' , 'jarrod');DEFINE ('DB_HOST' , 'localhost:8889');DEFINE ('DB_NAME' , 'ask');$dbcon = mysqli_connect(DB_HOST, DB_PSWD, DB_USER, DB_NAME);if (!$dbcon) { die('error connecting to database');}echo 'you have connected succesfully' ;?> In the database 'question' I have created a table called 'ask.' I have created a user 'jazza' and password 'jarrod'. On the top of the page it says 'server:8889'. When I try to test it on my server through dreamweaver, it says 'error connecting to database'. I can't figure out where I went wrong. Can anyone help me out? Thanks
  11. If you go to the website link I have provided, and look to the right. you would see the "ask question", new questions etc. I want to know how I can do that, but it only moves at a particular point. like the one on the link. Sorry for not providing enough info.
  12. Similar to the one on this website. ( http://www.codecademy.com/forums/ruby-beginner-en-d1Ylq/0 ) The right side of the page. Thanks
  13. I am building a question and answer website that is similar to yahoo answers but for remote control. How do I get the users question text to index to the home page, category page and their user dashboard?It's been bothering me because I can't start development until I have some idea on what to do. Thanks
  14. Yes, they are not where I want them. When I removed the fixed positioning and put absolute , it moved.
×
×
  • Create New...