Jump to content

badeand

Members
  • Posts

    34
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

badeand's Achievements

Member

Member (2/5)

0

Reputation

  1. Here is the form code. It stores the ID from another row in the mysql database instead of the value of the this row. It should get the value from another mysql table but instead it gets the ID of the row that it should get the value from.. <script type="text/javascript"> function confirmSubmit(){ var r=confirm("Er du sikker på at du vil sende skjema?"); if(r) return true; return false; } </script> <script type="text/javascript"> function addNewCase() { $('#afterdiv').after('<fieldset><legend>Legg til Utstyr <a href="#r" onclick="removeCase(this);" style="font-size: 11px">(x)Slett</a></legend><div><div class="item"><label for="case">Type Sak</label><select name="fields['+currentval+'][case]" id="case"><option value="">Vennligst velg type sak</option><? $q=mysql_query("select * from fields where type='case_type'") or die(mysql_error()); while($r=mysql_fetch_array($q)) { ?><option value="<?=$r['id']?>"><?=$r['value']?></option><? } ?></select></div><div class="item"><label for="error">Feilmelding</label><select name="fields['+currentval+'][error]" id="error"><option value="">Vennligst velg feilmelding</option><? $q=mysql_query("select * from fields where type='error_message'") or die(mysql_error()); while($r=mysql_fetch_array($q)) { ?><option value="<?=$r['id']?>"><?=$r['value']?></option><? } ?></select></div><div><label for="other">Annen feil</label><textarea name="fields['+currentval+'][other]" id="other" rows="12" cols="30"></textarea></div><label>Innlevert Utstyr</label></br></br><div class="item"><label for="hardwareid">Hardware ID</label><input type="text" name="fields['+currentval+'][hardwareid]" value="" size="30" class="hardwareid" id="fields['+currentval+'][hardwareid]"></div><div class="item"><label for="hardware">Demontert Modell</label><select name="fields['+currentval+'][hmodel]" id="fields['+currentval+'][hmodel]" class="hmodel"><option value="">Vennligst velg type utstyr</option><? $q=mysql_query("select * from fields where type='hardware_model'") or die(mysql_error()); while($r=mysql_fetch_array($q)) { ?><option value="<?=$r['id']?>"><?=$r['value']?></option><? } ?></select></br></div></br></br><label>Erstatnings utstyr</label></br><br><div class="item"><label for="hardwarerep">Hardware ID</label><input type="text" name="fields['+currentval+'][hardwarerep]" class="hardwarerep" value="" size="30" id="hardwarerep"></div><div class="item"><label for="replacement">Monetert Modell</label><select name="fields['+currentval+'][replacement]" id="fields['+currentval+'][replacement]" class="rmodel"><option value="">Vennligst velg type utstyr</option><? $q=mysql_query("select * from fields where type='replacement_model'") or die(mysql_error()); while($r=mysql_fetch_array($q)) { ?><option value="<?=$r['id']?>"><?=$r['value']?></option><? } ?></select></div></div></fieldset>'); currentval++; } function removeCase(el) { $(el).parent().parent().remove(); currentval--; } $(".hardwareid").live('blur', function() { var hi = $(this).attr('id').replace("fields[", "").replace("][hardwareid]",""); $.post("select.php", { hardid: $(this).val() ,type: 'id' }, function(data) { $('.hmodel').each(function() { if($(this).attr("id") == "fields["+hi+"][hmodel]") { $(this).find("option[value='"+data+"']").attr("selected",true); } }); }); }); $(".hardwarerep").live('blur', function() { var hi = $(this).attr('name').replace("fields[", "").replace("][hardwarerep]",""); $.post("select.php", { hardid: $(this).val(),type: 'rep' }, function(data) { $('.rmodel').each(function() { if($(this).attr("id") == "fields["+hi+"][replacement]") { $(this).find("option[value='"+data+"']").attr("selected",true); } }); }); }); </script>
  2. Could anyone help me and see why the script stores the ID into "replacement" row instead of the value from the form. If needed i can post the form script. ANY help would be appreciated Here is the process code <? include("db.php"); echo "<pre>"; foreach($_POST['fields'] as $items) { $qcheck1= mysql_query("select * from fields where id='".$items['hmodel']."'") or die(mysql_error()); $rcheck1=mysql_fetch_array($qcheck1); $hmodel = $rcheck1['value']; $qcheck2= mysql_query("select * from fields where id='".$items['case']."'") or die(mysql_error()); $rcheck2=mysql_fetch_array($qcheck2); $case = $rcheck2['value']; $qcheck3= mysql_query("select * from fields where id='".$items['error']."'") or die(mysql_error()); $rcheck3=mysql_fetch_array($qcheck3); $error = $rcheck3['value']; $q=mysql_query("INSERT INTO `customer_data` (`id`, `name`, `number`, `address`, `case`, `hmodel`, `error`, `other`, `hardwareid`, `replacement`, `hardwarerep`) VALUES (NULL, '".mysql_real_escape_string($_POST['name'])."', '".mysql_real_escape_string($_POST['number'])."', '".mysql_real_escape_string($_POST['address'])."', '".mysql_real_escape_string($case)."', '".mysql_real_escape_string($hmodel)."', '".mysql_real_escape_string($error)."', '".mysql_real_escape_string($items['other'])."', '".mysql_real_escape_string($items['hardwareid'])."', '".mysql_real_escape_string($items['replacement'])."', '".mysql_real_escape_string($items['hardwarerep'])."')") or die(mysql_error()); echo "<br> Din registrering har ID : ".mysql_insert_id(); } ?>
  3. Hi, I´m making a system that´s is meant to store information about some hardware and the different kind of error messages and fault that appears on the hardware. Each hardware has is it`s own unique hardware ID and it`s the last 4 digits in the Hardware ID ( serial number). Is there a way that i can detect wich hardware this is by making the php script looking for the 4 last digits in the serial and lookup this in a mysql table (that contains the different equipment and information about this) and pick the right equipment and then redirect to the right error handling page with the specified form for this equipment? Each equipment has it own error messages and known errors, so one error (form) for each equipment is needed.
  4. Ok, so now it?s finaly returning results, and correct results. Solved $query = mysql_query("SELECT *, b.name FROM tasks AS a LEFT JOIN login_users AS b ON a.made_id=b.user_id WHERE a.owner_id = '$user'"); Works fine! Thanks for the help
  5. Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/home.php on line 36 $query = mysql_query("SELECT *, b.name FROM tasks AS a LEFT JOIN login_users AS b ON a.owner_id=b.id WHERE a.owner_id = '$user' GROUP BY a.id"); The table names are correct. Should it be: ON a.made_id=b.id Since it`s the made_id that i?m trying to link up with the id on the users table? But this query failed as well..
  6. If i?m using that it print out an error
  7. This is a part of my Mysql query and getting the values from the rows wheres tasks.owner.id = logged in user so it only shows the tasks assigned to the logged in user. This is a task manager script i?m trying to make, so i want it to echo out who made this task by name, and the ID of the user that made it is stored in $made_id in table "tasks" and i need this to get the name (row) with the same id in the "users" table. How could i do this? As i see it, the query already contains booth the ID and the Name of the users, but i need to put theese to together in some way. $query = mysql_query("SELECT * FROM tasks JOIN login_users WHERE tasks.owner_id = '$user' GROUP BY tasks.id "); if ( mysql_num_rows( $query ) > 0 ) { while ($row = mysql_fetch_array($query)){ $id = $row['id']; $title = $row['title']; $details = $row['details']; $yourref = $row['yourref']; $made_id = $row['made_id']; $made_date = $row['made_date']; $due_date = $row['due_date']; $name = $row['name']; ?>
  8. Does anyone know of any open source - web based mysql report generator? Not thinking of an really advanced systems like LogiXML - but more of a simple web based query maker with simple (semi-advanced) functions. Would be good if it could save the reports to be called on later for example Or maybe someone would be interested in programming such a system? The ones i have found does not have the option to add date range. Smart Report Maker form mysqlreports.com does not support only having one database as most hosting services do.
  9. Could you delete the old thread? Much better explanation here Sorry for the re-post...
  10. Hi, Could anyone help me code this so it dosen´t have use the dropdown list to select databases? My hosting service does only provide me with one database, so i do not have access to run the mysql query "Show databases". And i´m having problems getting the logic of coding this so i always select the database i already have predefined. I hope someone could help me with this, it would me much appreciated. The part that i have issues with is this. Below this, the complete code for this file is uploaded. $query = "show databases;"; $result = mysql_query($query); $database_cmb_names = ''; //get the default value if(isset($database_name)) $default_db=$database_name; else $default_db=@$_SESSION['db']; while ($row = mysql_fetch_row($result)) { if($default_db==$row[0]) $database_cmb_names .= "<option selected>"; else $database_cmb_names .= "<option >"; $database_cmb_names .= $row[0]; $database_cmb_names .= "</option>\r\n"; } } } If i need to upload the rest of the files for this script, let me now. <?php session_start(); error_reporting(E_ERROR | E_PARSE); //get form variables //buttons if(isset($_POST['btn_cont_x'])) $btn_continue = $_POST['btn_cont_x']; if(isset($_POST['btn_back_x'])) $btn_back = $_POST['btn_back_x']; if(isset($_POST['btn_connect_x'])) $btn_connect = $_POST['btn_connect_x']; //input fields if(isset($_POST['host_name'])) $host_name = $_POST['host_name']; if(isset($_POST['user_name'])) $user_name = $_POST['user_name']; if(isset($_POST['password'])) $password = $_POST['password']; if(isset($_POST['database_name'])) $database_name = $_POST['database_name']; if(isset($_POST['data_source'])) $data_source = $_POST['data_source']; //vars $is_form_valid = 1; $page_errors = ''; //check which button was clicked if(!empty($btn_continue)) //continue { if(empty($host_name)) { $page_errors = "* Please enter host name."; $is_form_valid = 0; } if(empty($user_name)) { if(!empty($page_errors)) $page_errors .= "<br>"; $page_errors .= "* Please enter user name." ; $is_form_valid = 0; } if(empty($database_name)) { if(!empty($page_errors)) $page_errors .= "<br>"; $page_errors .="* Please select database name."; $is_form_valid = 0; } if($is_form_valid) { $_SESSION['db'] = $database_name; $_SESSION['datasource'] = $data_source; // table or query if($data_source =='sql') //sql query selected { header("Location:step_3_sql.php"); } else //table selected { header("Location:step_3.php"); } } } else if(!empty($btn_back)) //back { header("Location:step_1.php"); exit; } else if(!empty($btn_connect) || !empty($_SESSION['host'])) //connect or back { if(!empty($_SESSION['host']) && empty($btn_connect)) //back { $host_name = $_SESSION['host']; $user_name = $_SESSION['user']; $password = $_SESSION['pass']; } if(empty($host_name)) { $form_errors = "* Please enter host name."; $is_form_valid = 0; } if(empty($user_name)) { $page_errors .= "* Please enter user name." ; $is_form_valid = 0; } if($is_form_valid ==1) { if(@!mysql_connect($host_name, $user_name, $password)) { if(!empty($page_errors)) { $page_errors .="<br>"; } $page_errors .= "* Unable to connect. Please enter valid host name, user name and password"; } else { // save data in the sessions if(!empty($btn_connect)) // only in case of connect { $_SESSION['host'] = $host_name; $_SESSION['user'] = $user_name; $_SESSION['pass'] = $password; } $query = "show databases;"; $result = mysql_query($query); $database_cmb_names = ''; //get the default value if(isset($database_name)) $default_db=$database_name; else $default_db=@$_SESSION['db']; while ($row = mysql_fetch_row($result)) { if($default_db==$row[0]) $database_cmb_names .= "<option selected>"; else $database_cmb_names .= "<option >"; $database_cmb_names .= $row[0]; $database_cmb_names .= "</option>\r\n"; } } } } //functions section //get default valu for each form field function get_default_value($var) { $s_var = $var; if($var =='user_name') $s_var = 'user'; if($var=='password') $s_var = 'pass'; if($var=='host_name') $s_var = 'host'; if($var=='data_source') $s_var = 'datasource'; if(isset($_POST[$var])) { return $_POST[$var]; } else if(@isset($_SESSION[$s_var])) { return @$_SESSION[$s_var]; } else { if ($var=='host_name') { return 'localhost'; } } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Select table</title> <link href="style.css" rel="stylesheet" type="text/css"> <SCRIPT language="JavaScript1.2" src="main.js" type="text/javascript"></SCRIPT> </head> <body> <DIV id="TipLayer" style="visibility:hidden;position:absolute;z-index:1000;top:-100;"></DIV> <SCRIPT language="JavaScript1.2" src="style.js" type="text/javascript"></SCRIPT> <center> <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post"> <table border="0" height="468" cellspacing="0" cellpadding="0" width="732"> <tr> <td align="center" width="64" height="20" background="images/topleft.jpg" style="background-repeat: no-repeat" > <td align="center" width="614" height="20" background="images/top.jpg" style="background-repeat: x"> <td align="center" width="48" height="20" background="images/topright.jpg" style="background-repeat: no-repeat"> </tr> <tr> <td align="center" width="64" style="background-repeat: y" valign="top" background="images/leftadd.jpg"> <img border="0" src="images/left.jpg"><td rowspan="2" align="center" valign="top" > <p><img border="0" src="images/01.jpg" width="369" height="71"></p> <table border="0" width="100%" id="table8" height="333"> <tr> <td height="18" colspan="2" class="step_title">Please enter MySQL database parameters</td> </tr> <tr> <td colspan="2" height="271" valign="top"> <div align="center"> <table border="0" cellpadding="0" cellspacing="0" width="501" id="table11" height="248"> <tr> <td width="27" height="16"> <img border="0" src="images/ctopleft.jpg" width="38" height="37"></td> <td width="425" height="16" background="images/ctop.jpg" style="background-repeat: x"> </td> <td width="38" height="16"> <img border="0" src="images/ctopright.jpg" width="38" height="37"></td> </tr> <tr> <td width="27" background="images/cleft.jpg" style="background-repeat: y"> </td> <td width="425" bgcolor="#F9F9F9" align="center"> <table border="0" width="118%" id="table12" height="136"> <tr> <?php if(!empty($page_errors)) { echo "<td align='left' colspan='2' height='26' valign='top' class='error'>$page_errors</td>"; } ?> </tr> <tr> <td width="30%" align="right" class="control_label">Host name</td> <td width="68%" valign="middle"> <input name="host_name" type="text" id="host_name" value="<?php echo get_default_value('host_name')?>" size="21" /> <a href="" onMouseOver="stm(Step_2[0],Style);" onClick="return false;" onMouseOut="htm()"> <img src="images/Help.gif" width="20" height="15" border="0"></a></td> </tr> <tr> <td width="30%" align="right" class="control_label"> Username</td> <td width="68%" valign="middle"> <input name="user_name" type="text" id="user_name" size="21" value="<?php echo get_default_value('user_name') ?>"> <a href="" onMouseOver="stm(Step_2[1],Style);" onClick="return false;" onMouseOut="htm()"><img src="images/Help.gif" width="20" height="15" border="0"></a></td> </tr> <tr> <td width="30%" align="right" class="control_label"> Password</td> <td width="68%" valign="middle"> <input name="password" type="text" id="password" size="21" value="<?php get_default_value('password')?>"> <a href="" onMouseOver="stm(Step_2[2],Style);" onClick="return false;" onMouseOut="htm()"><img src="images/Help.gif" width="20" height="15" border="0"></a></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"> <p align="center"> <input name="btn_connect" type="image" id="btn_connect" src="layout/button_connect.gif" /> </td> </tr> <tr> <td width="30%" align="right" class="control_label">Select Database</td> <td width="68%"> <select name="database_name" size="1" id="database_name"> <?php echo($database_cmb_names); ?>; </select> <a href="" onMouseOver="stm(Step_2[3],Style);" onClick="return false;" onMouseOut="htm()"><img src="images/Help.gif" width="20" height="15" border="0"></a></td> </tr> <tr> <td width="30%" align="right" class="control_label"> Data Source </td> <td width="68%"> <select name="data_source" size="1" id="cmb_data_source0"> <option value="table" <?php if(get_default_value('data_source')=='table') echo 'selected'?>> Table</option> <option value="sql" <?php if(get_default_value('data_source')=='sql') echo 'selected'?>> SQL Query</option></select> <a href="" onMouseOver="stm(Step_2[4],Style);" onClick="return false;" onMouseOut="htm()"><img src="images/Help.gif" width="20" height="15" border="0"></a></td> </tr> </table></td> <td width="38" background="images/cright.jpg" style="background-repeat: y"> </td> </tr> <tr> <td width="27" height="18"> <img border="0" src="images/cdownleft.jpg" width="38" height="37"></td> <td width="425" height="18" background="images/cdown.jpg" style="background-repeat: x"> </td> <td width="38"> <img border="0" src="images/cdownright.jpg" width="38" height="37"></td> </tr> </table></div> </td> </tr> <tr> <td align="center"><a href="../index.php"><img src="images/03.jpg" border=0 width="170" height="34"></a></td> <td align="center"><INPUT name=btn_cont type=image id="btn_cont" src="images/04.jpg" width="166" height="34"></td> </tr> </table> <td align="center" width="48" style="background-repeat: y" valign="top" height="388" background="images/rightadd.jpg"> <img border="0" src="images/right.jpg"></tr> <tr> <td width="64" height="13" align="center" background="images/leftadd.jpg" style="background-repeat: y"> <td align="center" width="48" background="images/rightadd.jpg" style="background-repeat: y" valign="top"> </tr> </tr> <tr> <td align="center" width="64" height="30" style="background-repeat: no-repeat"> <img border="0" src="images/downleft.jpg" width="64" height="30"><td align="center" width="614" height="30" background="images/down.jpg" style="background-repeat: x"> <td align="center" width="48" height="30" background="images/downright.jpg" style="background-repeat: no-repeat" > <img border="0" src="images/downright.jpg" width="53" height="30"></tr> <td height="2"></tr> </table> </form> </body> </html> 17299_.php
  11. I have problems coding this script over to select my database with a pre-defined variable instead of using "show databases". I can´t use "show databases" because my hosting service only provide me with one database, so there are restrictions on listing of mysql databases. So i need to write this script to make the variable $database_name to ALWAYS be (i do not need to select databse, cause i only have one database with my hosting service) "MY_DATABASE". Could anyone help me to get this $database_name without using "show database" query. <?php session_start(); error_reporting(E_ERROR | E_PARSE); //get form variables //buttons if(isset($_POST['btn_cont_x'])) $btn_continue = $_POST['btn_cont_x']; if(isset($_POST['btn_back_x'])) $btn_back = $_POST['btn_back_x']; if(isset($_POST['btn_connect_x'])) $btn_connect = $_POST['btn_connect_x']; //input fields if(isset($_POST['host_name'])) $host_name = $_POST['host_name']; if(isset($_POST['user_name'])) $user_name = $_POST['user_name']; if(isset($_POST['password'])) $password = $_POST['password']; if(isset($_POST['database_name'])) $database_name = $_POST['database_name']; if(isset($_POST['data_source'])) $data_source = $_POST['data_source']; //vars $is_form_valid = 1; $page_errors = ''; //check which button was clicked if(!empty($btn_continue)) //continue { if(empty($host_name)) { $page_errors = "* Please enter host name."; $is_form_valid = 0; } if(empty($user_name)) { if(!empty($page_errors)) $page_errors .= "<br>"; $page_errors .= "* Please enter user name." ; $is_form_valid = 0; } if(empty($database_name)) { if(!empty($page_errors)) $page_errors .= "<br>"; $page_errors .="* Please select database name."; $is_form_valid = 0; } if($is_form_valid) { $_SESSION['db'] = $database_name; $_SESSION['datasource'] = $data_source; // table or query if($data_source =='sql') //sql query selected { header("Location:step_3_sql.php"); } else //table selected { header("Location:step_3.php"); } } } else if(!empty($btn_back)) //back { header("Location:step_1.php"); exit; } else if(!empty($btn_connect) || !empty($_SESSION['host'])) //connect or back { if(!empty($_SESSION['host']) && empty($btn_connect)) //back { $host_name = $_SESSION['host']; $user_name = $_SESSION['user']; $password = $_SESSION['pass']; } if(empty($host_name)) { $form_errors = "* Please enter host name."; $is_form_valid = 0; } if(empty($user_name)) { $page_errors .= "* Please enter user name." ; $is_form_valid = 0; } if($is_form_valid ==1) { if(@!mysql_connect($host_name, $user_name, $password)) { if(!empty($page_errors)) { $page_errors .="<br>"; } $page_errors .= "* Unable to connect. Please enter valid host name, user name and password"; } else { // save data in the sessions if(!empty($btn_connect)) // only in case of connect { $_SESSION['host'] = $host_name; $_SESSION['user'] = $user_name; $_SESSION['pass'] = $password; } $query = "show databases;"; $result = mysql_query($query); $database_cmb_names = ''; //get the default value if(isset($database_name)) $default_db=$database_name; else $default_db=@$_SESSION['db']; while ($row = mysql_fetch_row($result)) { if($default_db==$row[0]) $database_cmb_names .= "<option selected>"; else $database_cmb_names .= "<option >"; $database_cmb_names .= $row[0]; $database_cmb_names .= "</option>\r\n"; } } } } //functions section //get default valu for each form field function get_default_value($var) { $s_var = $var; if($var =='user_name') $s_var = 'user'; if($var=='password') $s_var = 'pass'; if($var=='host_name') $s_var = 'host'; if($var=='data_source') $s_var = 'datasource'; if(isset($_POST[$var])) { return $_POST[$var]; } else if(@isset($_SESSION[$s_var])) { return @$_SESSION[$s_var]; } else { if ($var=='host_name') { return 'localhost'; } } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Select table</title> <link href="style.css" rel="stylesheet" type="text/css"> <SCRIPT language="JavaScript1.2" src="main.js" type="text/javascript"></SCRIPT> </head> <body> <DIV id="TipLayer" style="visibility:hidden;position:absolute;z-index:1000;top:-100;"></DIV> <SCRIPT language="JavaScript1.2" src="style.js" type="text/javascript"></SCRIPT> <center> <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post"> <table border="0" height="468" cellspacing="0" cellpadding="0" width="732"> <tr> <td align="center" width="64" height="20" background="images/topleft.jpg" style="background-repeat: no-repeat" > <td align="center" width="614" height="20" background="images/top.jpg" style="background-repeat: x"> <td align="center" width="48" height="20" background="images/topright.jpg" style="background-repeat: no-repeat"> </tr> <tr> <td align="center" width="64" style="background-repeat: y" valign="top" background="images/leftadd.jpg"> <img border="0" src="images/left.jpg"><td rowspan="2" align="center" valign="top" > <p><img border="0" src="images/01.jpg" width="369" height="71"></p> <table border="0" width="100%" id="table8" height="333"> <tr> <td height="18" colspan="2" class="step_title">Please enter MySQL database parameters</td> </tr> <tr> <td colspan="2" height="271" valign="top"> <div align="center"> <table border="0" cellpadding="0" cellspacing="0" width="501" id="table11" height="248"> <tr> <td width="27" height="16"> <img border="0" src="images/ctopleft.jpg" width="38" height="37"></td> <td width="425" height="16" background="images/ctop.jpg" style="background-repeat: x"> </td> <td width="38" height="16"> <img border="0" src="images/ctopright.jpg" width="38" height="37"></td> </tr> <tr> <td width="27" background="images/cleft.jpg" style="background-repeat: y"> </td> <td width="425" bgcolor="#F9F9F9" align="center"> <table border="0" width="118%" id="table12" height="136"> <tr> <?php if(!empty($page_errors)) { echo "<td align='left' colspan='2' height='26' valign='top' class='error'>$page_errors</td>"; } ?> </tr> <tr> <td width="30%" align="right" class="control_label">Host name</td> <td width="68%" valign="middle"> <input name="host_name" type="text" id="host_name" value="<?php echo get_default_value('host_name')?>" size="21" /> <a href="" onMouseOver="stm(Step_2[0],Style);" onClick="return false;" onMouseOut="htm()"> <img src="images/Help.gif" width="20" height="15" border="0"></a></td> </tr> <tr> <td width="30%" align="right" class="control_label"> Username</td> <td width="68%" valign="middle"> <input name="user_name" type="text" id="user_name" size="21" value="<?php echo get_default_value('user_name') ?>"> <a href="" onMouseOver="stm(Step_2[1],Style);" onClick="return false;" onMouseOut="htm()"><img src="images/Help.gif" width="20" height="15" border="0"></a></td> </tr> <tr> <td width="30%" align="right" class="control_label"> Password</td> <td width="68%" valign="middle"> <input name="password" type="text" id="password" size="21" value="<?php get_default_value('password')?>"> <a href="" onMouseOver="stm(Step_2[2],Style);" onClick="return false;" onMouseOut="htm()"><img src="images/Help.gif" width="20" height="15" border="0"></a></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"> <p align="center"> <input name="btn_connect" type="image" id="btn_connect" src="layout/button_connect.gif" /> </td> </tr> <tr> <td width="30%" align="right" class="control_label">Select Database</td> <td width="68%"> <select name="database_name" size="1" id="database_name"> <?php echo($database_cmb_names); ?>; </select> <a href="" onMouseOver="stm(Step_2[3],Style);" onClick="return false;" onMouseOut="htm()"><img src="images/Help.gif" width="20" height="15" border="0"></a></td> </tr> <tr> <td width="30%" align="right" class="control_label"> Data Source </td> <td width="68%"> <select name="data_source" size="1" id="cmb_data_source0"> <option value="table" <?php if(get_default_value('data_source')=='table') echo 'selected'?>> Table</option> <option value="sql" <?php if(get_default_value('data_source')=='sql') echo 'selected'?>> SQL Query</option></select> <a href="" onMouseOver="stm(Step_2[4],Style);" onClick="return false;" onMouseOut="htm()"><img src="images/Help.gif" width="20" height="15" border="0"></a></td> </tr> </table></td> <td width="38" background="images/cright.jpg" style="background-repeat: y"> </td> </tr> <tr> <td width="27" height="18"> <img border="0" src="images/cdownleft.jpg" width="38" height="37"></td> <td width="425" height="18" background="images/cdown.jpg" style="background-repeat: x"> </td> <td width="38"> <img border="0" src="images/cdownright.jpg" width="38" height="37"></td> </tr> </table></div> </td> </tr> <tr> <td align="center"><a href="../index.php"><img src="images/03.jpg" border=0 width="170" height="34"></a></td> <td align="center"><INPUT name=btn_cont type=image id="btn_cont" src="images/04.jpg" width="166" height="34"></td> </tr> </table> <td align="center" width="48" style="background-repeat: y" valign="top" height="388" background="images/rightadd.jpg"> <img border="0" src="images/right.jpg"></tr> <tr> <td width="64" height="13" align="center" background="images/leftadd.jpg" style="background-repeat: y"> <td align="center" width="48" background="images/rightadd.jpg" style="background-repeat: y" valign="top"> </tr> </tr> <tr> <td align="center" width="64" height="30" style="background-repeat: no-repeat"> <img border="0" src="images/downleft.jpg" width="64" height="30"><td align="center" width="614" height="30" background="images/down.jpg" style="background-repeat: x"> <td align="center" width="48" height="30" background="images/downright.jpg" style="background-repeat: no-repeat" > <img border="0" src="images/downright.jpg" width="53" height="30"></tr> <td height="2"></tr> </table> </form> </body> </html>
  12. Hi, I'm trying to get out the average of records stored in a mysql table This is the code im using right now mysql_query("SELECT DATE(dato) , COUNT( dato ) AS counted FROM dekodere GROUP BY date(dato)", $link); $ave = mysql_num_rows($ave); This is getting out the average, but i need to exclude weekends because there is not stored anything during the weekend so it's making the average go off.. any tips?
  13. This is the value of thoose variables 2011-01-01 16:02:42 1295019624 1295017613
  14. Hi people I'm trying to show all my data in my database, and I'm trying to make the font color change after 7 days to yellow and after 14 days it should show up red. But it does not work, could someone see any error in the code? It turns up green all the time.. while($row = mysql_fetch_array($result)) { $postTime = $row['date']; $thisTime = time(); $timeDiff = $thisTime-$postTime; if($timeDiff <= 604800) { // Less than 7 days[60*60*24*7] $color = '#D1180A'; } else if($timeDiff > 604800 && $timeDiff <= 1209600) { // Greater than 7 days[60*60*24*7], less than 14 days[60*60*24*14] $color = '#D1B30A'; } else if($timeDiff > 1209600) { // Greater than 14 days[60*60*24*14] $color = '#08C90F'; } echo '<tr style="color: '.$color.';">'; echo '<td>'. $row['id'] .'</td>'; echo '<td>'. date("d.m.y", strtotime($row["date"])) .' </td>'; echo '<td><a href="detaljer.php?view='. $row['id'] .'">'. $row['Navn'] .'</a></td>'; echo '<td>'. $row['Telefon'] .'</td>'; echo '<td>'. $row['Emne'] .'</td>'; echo '</tr>'; } echo '</table>';
  15. Thanks Pikachu2000 I've just started reading about form validation and found that it is a critical part
×
×
  • 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.