-
Posts
837 -
Joined
-
Last visited
-
Days Won
1
Posts posted by phppup
-
-
Thanks DAVID.
So there really is no way to just stick NY time into a database? Or does this set the timezone perminently?
-
Plenty of times, and it JUSt won't function for me.
-
see above... need proper syntax
-
I've tried it several times, but it never seems to work for me.
How scan i simply echo: it is now xxxx in New York?
-
That's probably suffiecient.
Now I see why it might be advantages to using TINYINT's instead of VARCHARs.
Nonetheless, a row with 150 or 200 VARCHAR columns shouldn't be a problem, should it?
-
Does time zone change have to occur in an INI file, or can I place it as a value.
I've tried using default_time_zone ('America/New York') but had no success with it, even to just ECHO a statement that says: It is now 3:50PM in New York.
-
Along the same lines as a "Thank you for you submission" message, is there a simple way to echo the CHANGES made to a record AFTER it has been UPDATED.
For example: You have added 2 skirts and 1 shirt to your order
OR You're order has been reduced by 2 pair of socks.
This would compare what was stored with the change.
Alternately, is there a way to show a message that ONLY addresses the values that have CHANGED as a result of the UPDATE.
Example: You have altered the quantity of the following items: dresses, hats, gloves.
-
Is there a limit to the number of columns a table can have?
100? 200?? some crazy large number not to be concerned with?
-
WOW! found the same line of code in my UPDATE script. Took it out and I'm working fine now.
Thanks a TON!
(i think i'll quit while ahead... LOL)
So what EXACTLY is that line saying?
And is it necessary in one way or another as a double-check process of the form?
-
It worked prviously with it (i think!), but i took it out and it seems to have repaired the problem.
So what EXACTLY is that line saying?
And is it necessary in one way or another as a double-check process of the form?
-
CONNECT
if(isset($_POST['action']) && $_POST['action'] == 'submitform')
{
$roastturkey = $_POST['roastturkey'];
$broccoli = $_POST['broccoli'];
$brisket = $_POST['brisket'];
$carrots = $_POST['carrots'];
}
$sql = "INSERT INTO pass (roastturkey,broccoli,brisket,carrots) VALUES ('$roastturkey','$broccoli','$brisket','$carrots')";
$result=mysql_query($sql);
if($result){
echo "Successful";
}else {
echo "ERROR";
}
Fairly simple, I think, and it used to work.
** Disclaimer: Not responsible if this code causes hunger or urges to snack **
-
I will start posting code if I have to, but first, the only "adjustment" made to the actual database was that I may have added to columns (at various locations between others) and then I later deleted them.
I have since replaced them as a troubleshooting technique, but their NAMES are NOT receiving any values (which is why I removed them in the first place).
Does this sort of manuever affect the tables??
(I'm a newbie, so maybe I just messed it up... LOL)
-
My database was working fine (for test purposes) a week ago. Now, it will not record data input from my forms.
If I add a new record, it adds the record, but none of the data.
If I update a record, it erases the values.
The forms and attached scripts have NOT undergone any changes, and they DO provide SUCCESS messages.
Ideas?
-
I may be on my way to a solution.
Question: If the code below will scan ALL fields of my form, how can I add to the code to eliminate just one or two of the inputs, while leaving the remaining 30?
$myUpdateList = array();foreach($_POST as $indexName => $value) { $myUpdateList[] = "$indexName = \"$value
-
okay.
still got similar message.
There is no success message so I have to assume I'm connecting.
Gonna need to check the database directly, but got same messages twice (only variations were from order number and item quantitieis.)
-
Still runnning your code and I got:
Array
(
[record_id] => 2
[roastturkey] => 4.00
[broccoli] => 0.00
[brisket] => 0.00
[carrots] => 0.00
[submitpass] => Submit Order
)
-
Drum: I used your code in place of mine (with commented areas remaining commented) and got a BLANK screen response.
Pikachu: How shall i do that? (please be specific as to where to place code if you provide any)
-
I only get messages from "echo MySQL" when there is success, so I have to assume that there are no messages on failure because there is NO DATA being transferred. The $id_record connection is not being made. :-(
-
It did NOT work.
I commented OUT these lines, and hardcoded the third, and DID get a SUCCESS message:
#$pass = array();foreach($_POST as $indexName => $value) { $pass[] = "$indexName = \"$value\"";}
#$fields = implode(",", $pass);
$sql=("UPDATE pass SET carrots ='6' WHERE id = '5' ");
So now what??
-
Am i adding anyplace specific, because when I put it where I thought it should go, I still get the same failure ERROR.
-
Evidently you're assuming that I understand certain things that i do NOT know, and I'm making the same mistake with you. I am trying to save a little room in the thread, but apparently that is backfiring too.
Page 1 is a dropdown that sorts the ID's to become $record_id (code on previous page)
works fine.
Page 2 displays the form with inputs that can be changed (also displays okay)
CONNECT
$record_id = (isset($_POST['record_id'])) ? $_POST['record_id'] : ''; if(!empty($record_id)) { $result = mysql_query("SELECT * FROM pass WHERE id = $record_id ") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo "<FORM name='orderpage' action='myupdatepage.php' method='post'>"; echo "<tr><td>"; echo "<select name='roastturkey'>"; echo "<option value='0.00' " . ($row['roastturkey'] == 0.00 ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($row['roastturkey'] == 1.00 ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00' " . ($row['roastturkey'] == 2.00 ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00' " . ($row['roastturkey'] == 3.00 ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00' " . ($row['roastturkey'] == 4.00 ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00' " . ($row['roastturkey'] == 5.00 ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00' " . ($row['roastturkey'] == 6.00 ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00' " . ($row['roastturkey'] == 7.00 ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00' " . ($row['roastturkey'] == 8.00 ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00' " . ($row['roastturkey'] == 9.00 ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00' " . ($row['roastturkey'] == 10.00 ? 'selected="selected"' : '') . ">10</option>"; echo " </select></td><td rowspan='2'>ROAST TURKEY</span></td><td rowspan='2'>7.00 LB</span></td> "; echo " <td rowspan='2'>ujiujjpooj</span></td><td rowspan='2'> <!-- FILLER --> </span></td>"; echo " <td> <!-- BLANK CELL --> </td><td>STEAMED VEGETABLES</td><td>16.00 LB</td><td>ujiujjpooj</td>"; echo "</tr>"; echo "<tr><td> <!-- FILLER for SPAN--> </td>"; echo " <td>"; echo " <select name='broccoli'>"; echo "<option value='0.00' " . ($row['broccoli'] == 0.00 ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($row['broccoli'] == 1.00 ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00' " . ($row['broccoli'] == 2.00 ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00' " . ($row['broccoli'] == 3.00 ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00' " . ($row['broccoli'] == 4.00 ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00' " . ($row['broccoli'] == 5.00 ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00' " . ($row['broccoli'] == 6.00 ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00' " . ($row['broccoli'] == 7.00 ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00' " . ($row['broccoli'] == 8.00 ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00' " . ($row['broccoli'] == 9.00 ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00' " . ($row['broccoli'] == 10.00 ? 'selected="selected"' : '') . ">10</option>"; echo " </select></td><td> BROCCOLI</td><td> <!-- NO PRICE HERE --> </td><td>ujiujjpooj</td>"; echo "</tr>"; echo "<tr><td>"; echo " <select name='brisket'>"; echo "<option value='0.00' " . ($row['brisket'] == 0.00 ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($row['brisket'] == 1.00 ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00' " . ($row['brisket'] == 2.00 ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00' " . ($row['brisket'] == 3.00 ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00' " . ($row['brisket'] == 4.00 ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00' " . ($row['brisket'] == 5.00 ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00' " . ($row['brisket'] == 6.00 ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00' " . ($row['brisket'] == 7.00 ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00' " . ($row['brisket'] == 8.00 ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00' " . ($row['brisket'] == 9.00 ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00' " . ($row['brisket'] == 10.00 ? 'selected="selected"' : '') . ">10</option>"; echo " </select></td><td>BRISKET OF BEEF</td><td>32.00 LB</td><td>ujiujjpooj</td><td> <!-- FILLER --> </td>"; echo " <td>"; echo " <select name='carrots'>"; echo "<option value='0.00' " . ($row['carrots'] == 0.00 ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($row['carrots'] == 1.00 ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00' " . ($row['carrots'] == 2.00 ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00' " . ($row['carrots'] == 3.00 ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00' " . ($row['carrots'] == 4.00 ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00' " . ($row['carrots'] == 5.00 ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00' " . ($row['carrots'] == 6.00 ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00' " . ($row['carrots'] == 7.00 ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00' " . ($row['carrots'] == 8.00 ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00' " . ($row['carrots'] == 9.00 ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00' " . ($row['carrots'] == 10.00 ? 'selected="selected"' : '') . ">10</option>"; echo " </select></td><td>CARROTS</td><td> <!-- NO PRICE HERE --> </td><td>ujiujjpooj</td>"; echo "</tr>"; <td><input type='submit' name='submitpass' value='Submit Order'>
Now, if anything is to be UPDATED, the changes would have been made and when submitted to myupdatepage.php I would get a SUCCESS, not ERROR
CONNECT
$roastturkey = $_POST['roastturkey']; $broccoli = $_POST['broccoli']; $brisket = $_POST['brisket']; $carrots = $_POST['carrots']; $mytabletest = array();foreach($_POST as $indexName => $value) { $mytabletest[] = "$indexName = \"$value\"";} $fields = implode(",", $mytabletest); $sql=("UPDATE mytabletest SET $fields WHERE id = $record_id "); if($result){ echo "Successful"; } else { echo "ERROR"; }
I need to know what to add, and WHERE to place it.
-
I'm unable to get from page 2 to page 3 with a SUCCESSful UPDATING of the DB
-
ALL the code is posted at bottom of this page 2
-
the first page has this code to display the fields:
connect:
$result = mysql_query("SELECT * FROM pass WHERE id = $record_id ")
or die(mysql_error());
$row = mysql_fetch_array( $result );
echo echo echo submit button
the second file that gets called AFTER submission of UPDATES is:
if(isset($_POST['action']) && $_POST['action'] == 'submitform')
{ $roastturkey = $_POST['roastturkey'];
$broccoli = $_POST['broccoli'];
$brisket = $_POST['brisket'];
$carrots = $_POST['carrots'];
}
$pass = array();foreach($_POST as $indexName => $value) { $pass[] = "$indexName = \"$value\"";}
$fields = implode(",", $pass);
$sql=("UPDATE pass SET $fields WHERE id = $record_id
$result=mysql_query($sql); ");
if($result){
echo "Successful";
else {
echo "ERROR";
}
so where exactly shall i put new code??
a question of TIME
in PHP Coding Help
Posted
code you've written:
echo "it is now $date_default_timezone_set('America/New_York')"; $NOW()
comprehensive explanation of the problem:
It won't provide the time.