Jump to content

emmavt

Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

emmavt's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I tried the code it was accepted by my editor as correct syntax but then got an error on the back side on the server. Could it be the table Engine type such as ? Wondering if I need to make sure it is MyISAM. I may try the code on a diferent server where I can see the backend.
  2. I am using a mysqli_query to insert text into a VARCHAR field field any any words after the whitespace are dropped when I pull from the database. I modified the field to be TEXT or BLOB and the same thing happens. I am not sure if it the text is being trimmed out when going into the database or coming out. Unfortunately, I cannot see the data in the database besides doing a query because we do not have anything like myPHP Admin. Any thoughts code below. $sql="UPDATE date_tbl SET dt_startDate='$_POST[dt_startDate]', dt_endDate='$_POST[dt_endDate]', dt_headline='$_POST[dt_headline]', dt_text='$my_text', dt_tag='$_POST[dt_tag]', dt_media='$_POST[dt_media]', dt_thumbnail='$_POST[dt_thumbnail]', dt_credit='$_POST[dt_credit]', dt_caption='$_POST[dt_caption]' WHERE dt_id ='$_POST[dt_id]'"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error()); } echo "$my_text"; echo "1 record updated"; mysqli_close($con);
  3. Hello all. I am building a web site for a friend and an it needs to be PHP/HTML based. I am trying to have her add her own verbiage by entering it into a text file. Do you know of a way to call variables and their values from a text file? I dfo this in actionscript for Flash, but I am trying to do it in PHP.
  4. I have a products table that I have created from a query, but I need to update the information based on quatity. What I am confused about is how to pass the multiple values to another page when they have the same variable names. here is my table: echo "<table width='100' border='1'><form>"; echo "<tr><th>Product ID</th><th>Name</th><th>Price</th><th>Quantity</th><th>Total Price</th></tr>"; $count=0; while($row2=mysql_fetch_assoc($result2)){ //grabbing results from the query $id=$row2['id']; $productid=$row2['productid']; $name=$row2['name']; $price=$row2['price']; $quantity=$row2['quantity']; $totalprice=$price * $quantity; $count++; echo "<tr><td>$productid</td> <td>$name</td> <td>$price</td> <td>$quantity</td> <td>$totalprice</td></tr>" ; } //end table for db results echo "</form></table>"; Any help wouyld be greatly appreciated!
  5. Hello. I am new to PHP and trying to use a PHP variable and pass it every time I call the page. The variable is $rn that should be a called randomly using rand() if the value of it is empty. However, the following code does not work. if (isset($guess)) { $rn = rand(1, 100); } The form in the page calls itself so it reloads and I am wondering how I pass this variable in the form each time and when the variable is sert to a value, not have rand() overwrite the value. Here is all my code. Thanks in advance Emma <!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=iso-8859-1" /> <title>Untitled Document</title> </head> <body> What is your guess? <?php echo "<FORM METHOD='POST' ACTION='j_rand.php'>"; echo "<INPUT NAME='Name' TYPE='TEXT'>"; echo "<br>"; //echo "<INPUT TYPE='HIDDEN' NAME='rn' VALUE='hello'>"; echo "<br>"; echo "<INPUT TYPE='SUBMIT' VALUE='SUBMIT'>"; echo "</FORM>"; if (isset($rn)) { $rn = rand(1, 100); } echo "This is the random number " . $rn . "<br>"; $guess = $_POST['Name']; echo "This is the guess ", $guess, "<br>"; if ($guess == $rn) { echo "<br>Correct!"; } elseif ($guess > $rn) { echo "<br>To high. Guess again."; } elseif ($guess < $rn && $guess > 0) { echo "<br>To low. Guess again."; } elseif (isset($guess)) { echo 'Please enter a guess'; } else { echo "<br>You broke it!"; } ?> </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.