-
Posts
289 -
Joined
-
Last visited
Posts posted by adam84
-
-
Its similar, the code you gave me didnt have the screw column in it. Or the table formatting.
-
Between:
INSERT INTO tbl_auth_user SET user_id='$user_id', user_password='$user_password' , ID = '3'
and:
INSERT INTO tbl_auth_user (user_id, user_password) VALUES ('user', PASSWORD('password'))
I don't think the first example would work because you use the 'SET' keyword to update a table rather then to insert something into a table.
UPDATE tbl_auth_user SET user_id='$user_id', user_password='$user_password' WHERE ID = '3'
You code would work, but since you dont have a WHEREclause, it is going to update every row in your tbl_auth_user table. Which isn't a good idea
-
$query = "SELECT SUM(week1-week1hours) AS theSum FROM staff JOIN project ON project.staff_id=staff.id WHERE project.staff_id='$id'"; $result = mysql_query($query) or die(mysql_error()); $totalRows = mysql_num_rows( $result ); while($row = mysql_fetch_array($result)){ if ($row['theSum'] > -1){ echo $row['theSum'] * $totalRows; else{ echo "<span class='red'>".$row['theSum'] . "</span>"; }
-
Couldn't you use a cron job to run that script every 15 minutes?
-
SELECT i.instock FROM inventory i, products p WHERE i.instock < 1 AND p.item_number = i.id
-
Javascript:
function doCalc( index, total ){ var num = document.getElementById('quant'+index).value; var gTotal = 0; if( !isNaN( num ) && num != '' ) document.getElementById('total'+index).innerHTML = (parseFloat(document.getElementById('price'+index).value) * parseInt(num)).toFixed(2); else document.getElementById('total'+index).innerHTML = '0.00'; for(var i = 0; i < total; i++ ) gTotal += parseFloat(document.getElementById('total'+i).innerHTML); document.getElementById('vTotal').innerHTML = gTotal.toFixed(2); }
PHP
<?php function populate_ordering_products($id){ dbconnect(); $sql = "SELECT * FROM product_spec WHERE category_id = ".$id; $result = mysql_query($sql); echo " <table width='842'> <tr> <td >Product ID</td> <td >Energy</td> <td >Brightness</td> <td >Fitting</td> <td >Quantity</td> <td >Info?</td> </tr>"; $totalRows = mysql_num_rows( $result ); $index = 0; while(($row = mysql_fetch_row($result)) != false) { $product_id = $row[1]; $product_name = get_productname($product_id); echo "<tr> <td>".$product_name."</td> <td>".$row[2]."</td> <td>".$row[3]."</td> <td>".$row[4]."</td> <td><input type='text' name='val$index' id='val$index' style='width:35px;' ONKEYUP='doCalc($index,$totalRows);'/></td> <td><input type='text' name='tot_val$index' id='tot_val$index' style='width:35px;' DISABLED VALUE='5.00'/></td> </tr>"; } //I didnt know where you wanted the totals, so I just put it in the last row echo "<TR><TD COLSPAN=3><B>Total: $</B> <SPAN NAME=vTotal ID=vTotal>0.00</SPAN></TR>"; echo "</table>"; } ?>
Hope this helps
-
no i couldnt see that the attachment. I didnt show up
-
would you be able to post all the code that is in your while loop
-
ok, so are you able to successfully get the total for each product?
Product 1: €4.00 x 3 -> Total €12
???
-
show me what you have so far and I will help you out with it
-
JS
<SCRIPT> function doCalc( num ){ //test to make sure that it is a number - to lazy to do it //do number formating document.getElementById('total').innerHTML = document.getElementById('price').value * num; } </SCRIPT>
HTML
Quantity: <input type="text" SIZE=3 NAME='quant' ID='quant' ONKEYUP='doCalc(this.value);'><BR> Price $<input SIZE=5 type="text" NAME='price' ID='price' DISABLED VALUE='5.00'><BR> Total: $<SPAN ID=total NAME=total>0.00</SPAN>
-
Go here http://www.webdeveloper.com/forum/showthread.php?t=40133 a bunch of people have wrote different functions on how they check to see if a table exists or not.
-
<input type="text" name="query" maxlength="100" size=75 value="Enter your search string here" onfocus="this.value='';">
-
Thanks, I puting in the brackets did not even cross my mind. I have never seen something like that before. Anyways, thanks for you help.
-
I want to loop through all the checkboxes and check or uncheck each of the city box. But whe n the JS selAll function gets called, I always get an error that says
"Error: document.cityFRM.city has no properties".
Any Ideas?
Javascript
function selAll( check ){ alert( document.cityFRM.city.length ); }
HTML
<FORM NAME='cityFRM' ID='cityFRM' METHOD=GET ACTION='city.php'> <INPUT TYPE=CHECKBOX ONCLICK='javascript:selAll(this.checked);'>Check All<BR> <INPUT TYPE=CHECKBOX VALUE='New York' NAME='city[]' ID='city[]'>New York <INPUT TYPE=CHECKBOX VALUE='Chicago' NAME='city[]' ID='city[]'>Chicago <INPUT TYPE=CHECKBOX VALUE='Los Angeles' NAME='city[]' ID='city[]'>Los Angeles <INPUT TYPE=CHECKBOX VALUE='Detroit' NAME='city[]' ID='city[]'>Detroit </FORM>
*I need to keep the the checkbox name an array, "city[]". I just want to know how to loop through them.
-
if I am following you correct, would this work??
<?php if((isset($_SESSION['errorstate'])) && ($_SESSION['errorstate'] == 1)) { //check for the sessions and if there is an error if( $_SESSION['errorstate'] < 1 ) $class = 'fade_valid'; else $class = 'fade_error'; echo "<div id='message' class='$class'>"; foreach($_SESSION['errormessage'] as $key => $value){ //print the errors echo $value.'<br />'; } echo "</div>"; //clear the errors $_SESSION['errorstate'] = ""; $_SESSION['errormessage'] = ""; } ?>
-
function generate_titles($conn){ $titles=""; $query = "SELECT cState FROM tblState"; $result = odbc_exec($conn, $query); while ($return = odbc_fetch_array($result)){ $titles.="<option value='".$return[cState]."'>".$return[cState]."</option>"; } return $titles; }
You need to put quotes around the option value. If you dont put the quotes and there is a space in the value, only the first word will be set to the value. Like in your case, only 'new was set to the value rather then 'new jersey'
-
Why do you have 'return $connection'? Your code is stopping at the point. Remove that line and try it again.
-
Try this:
$getRecord_sql = "select pkey from jiraissue where project = '10040' and pkey like '%".$searchq."%'";
-
Yea man, something else is giving you a problem.
-
Unless we see what is being stored in the arrays, I do not think there is a whole lot we can do for you.
-
$i=0; while($data = mysql_fetch_array($get_matches)) { if($i == 0) { $temp = $data['date']; } if($data['date'] == $temp) { //print match echo"$data[hometeam] - $data[awayteam] $data[goals_home]-$data[goals_away]<br>"; } else { break; } $i++; }
but still nothing is printed
This is just an idea on what you need to do. I do not know what you were doing.
echo $data['hometeam'] ." - ". $data['awayteam'] . " " . $data['goals_home'] ." - " . $data['goals_away'] . "<br>";
-
You would need to create a function that would count to how ever length you want it to split up the string, and if the end character a space, then return the string else you can loop forward until you find the next instance of a space.
-
I am pretty sure, you can only insert one row at a time.
Try somthing like this:
$i=1; $successfull = 0; $flag = false; while($i<=$no_of_rooms){ $q.="INSERT INTO `rooms` ( `name`,`property_id` ) VALUES ('$i', '$id');"; if( mysql_query($q) ){ $successfull++; } else { echo mysql_error(); $flag = true; break; } $i++; } if( $successfull > 0 && !$flag ){ echo 'No worries'; }else{ echo 'Error, please try again'; }
Calculating a total in a textfield?
in Javascript Help
Posted
did your copy over the new js function I created? Before the doCalc took in three parameters, not it only take in two, an index and total rows