Jump to content

Jazza

Members
  • Posts

    22
  • Joined

  • Last visited

Posts posted by Jazza

  1. The $_POST index names 'title', 'price', 'stock' etc do not exist at all, so referencing them give you undefined error and so no values will be retrieved.

    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>
    
  2. 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.

  3. <nav class="navbar navbar-default" role="navigation">    <div class="navbar-header">        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">            <span class="sr-only">Toggle navigation</span>            <span class="icon-bar"></span>            <span class="icon-bar"></span>            <span class="icon-bar"></span>        </button>        <a class="navbar-brand" href="#">Company Logo</a>    </div>    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">        <ul class="nav navbar-nav">            <li class="active"><a href="#"><span class="glyphicon glyphicon-bell aria-hidden="true"></span> Link</a></li>            <li><a href="#"> <span class="glyphicon glyphicon-comment aria-hidden="true"></span> Link</a></li>        </ul>        <div class="col-sm-3 col-md-3 pull-right">            <form class="navbar-form" role="search">                <div class="input-group">                    <input type="text" class="form-control" placeholder="Search" name="q">                    <div class="input-group-btn">                        <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>                    </div>                </div>            </form>        </div>            </div></nav>    

    is its something like this u are trying to achieve?

     

     

     

    Yes, however I prefer the icon's to be on the right side and the search field to be in the center.

  4. can you post the css

     

    #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;
    }
  5. 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

    post-100347-0-04867700-1428210254_thumb.png

  6. What you need for DB_NAME is not 'ask'. That is the name of the table. You need to use the database name, which you said was 'question'.

     

    Also, you should never post your username/password publically. I'd recommend changing them.

    Still no luck connecting.

  7. 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

  8. 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.

  9. 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

  10. Hi.

    I have making a website with html/css and am having some trouble. I have all the html divs in one (nav) and some other writing in a box inside the main div. (so the box is in the nav)

    I have lots of writing in the box but its not scrolling down.

    Here is my code:

    #nav{ width:1000px; height:700px; background-color:#FFF; position:fixed; left:100px; right:100px; top:0px; margin-left:auto; margin-right:auto; border-style:solid; border-width:thin;}

    #box{ width:500px; height:5000px; position:fixed; top:500px; left:150px; background-color:#FFF; border-style:dashed; border-width:thin; overflow:scroll; }

     

     

     

    It has been bothering me for a couple of days.

     

     

    Thanks

     

     

     

    EDIT: I dont know why I wrote "page not scrolling down with page"

    Please ignore with page.

  11. I have created a website in HTML/CSS, and when I preview the site in google chrome/ explorer is doesnt scroll down to other parts of the page. I have tried the HTML code, Overflow:scroll; but no luck. This its one of the elements I have created, that goes over the page and #mediumsquare{width:300px;height:250px;background-color:#339;position:fixed;top:520px;left:500px;} Thanks

×
×
  • Create New...