Jump to content

nicedad

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by nicedad

  1. Hello buddies, I'm trying to create a form through wich one can add entries into DB. unfortunately, it works only with the first two text fields (Name, Geburtstag) and when I add additional field (Kontaktdetails) It won't work , when I get rid of the last one it functions greate. even though the code seems to me ok. what's the issue here. thanks in advance here is the insert.php <table width="300" border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <td><form name="form1" method="post" action="insert_ac.php"> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td colspan="3"><strong>Insert Data Into mySQL Database </strong></td> </tr> <tr> <td width="71">Name</td> <td width="6">:</td> <td width="301"><input name="name" type="text" id="name"></td> </tr> <tr> <td width="71">Geburtstag</td> <td width="6">:</td> <td width="301"><input name="Geburtstag" type="text" id="Geburtstag"></td> </tr> <tr> <td width="71">Kontakdetails</td> <td width="6">:</td> <td width="301"><input name="kont" type="text" id="kont"></td> </tr> <tr> <td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </form> </td> </tr> </table> insert_ac.php <?php error_reporting(0); $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test_db"; $tbl_name="worker3"; // Table name mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $name=$_POST['name']; $geburtstag=$_POST['Geburtstag']; $kontakdetails=$_POST['kont']; $sql="INSERT INTO $tbl_name(name, Geburtstag, kont) VALUES('$name', '$geburtstag', '$kontakdetails')"; $result=mysql_query($sql); if($result){ echo "Successful"; echo "<BR>"; echo "<a href='insert.php'>Back to main page</a>"; } else { echo "ERROR"; } ?> <?php mysql_close(); ?>
  2. Ch0cu3rthanks so much Ch0CU3R , i really appreciate your help. It did work perfectly. best regards,
  3. Hi Ch0cu3r, thanks so much for the replay. however, the line in the loop is to separate the rows in the table. I tried your suggestion unfortunately still same problem (the only difference is the rows ware in one color). wat I wanted is, the title's row should corresponds the records rows in the space and there should be a enugh space between title's row as well as between records. cheers,
  4. Hi everyone, I'm trying to retrieve data from MySql table. It works greate unfortunately, I couldn't plot the table in a beautiful way (see attached image). As I'm not professional in PHP, I only try to generate code and it worked but this desigen problem. It need it to be like the table in the image 2. thanks in advance, Here is the code: <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Test</title> <style> label,a { font-family : Arial, Helvetica, sans-serif; font-size : 12px; } </style> </head> <body> <?Php //ini_set('display_errors', true);//Set this display to display all erros while testing and developing the script error_reporting(0);// With this no error reporting will be there include "include/z_db.php"; $todo=$_POST['todo']; $search_text=$_POST['search_text']; if(strlen($serch_text) > 0){ if(!ctype_alnum($search_text)){ echo "Data Error"; exit; } } ////////// Displaying the search box ///// echo "<table> <tr><td colspan=2 align='center'>"; echo "<form method=post action=''><input type=hidden name=todo value=search> <input type=text name=search_text value='$search_text'><input type=submit value=Search><br> <input type=radio name=type value=any checked>Suche by Beruf <input type=radio name=type value=exact>Search by Gemeinde </form> "; echo "</td></tr>"; /////////// if form is submitted the data processing is done here/////////////// echo "<tr><td width='600' valign=top>"; if(isset($todo) and $todo=="search"){ $type=$_POST['type']; $search_text=ltrim($search_text); $search_text=rtrim($search_text); if($type<>"any"){ $query="select * from worker3 where Gemeinde='$search_text'"; }else{ $kt=split(" ",$search_text);//Breaking the string to array of words // Now let us generate the sql while(list($key,$val)=each($kt)){ if($val<>" " and strlen($val) > 0){$q .= " Beruf like '%$val%' or ";} }// end of while $q=substr($q,0,(strLen($q)-3)); // this will remove the last or from the string. $query="select * from worker3 where $q "; } // end of if else based on type value echo "<span style='background-color= #FFFF00'>Sie habe folgende Daten ausgewehlt</span><br>"; $count=$dbo->prepare($query); $count->execute(); $no=$count->rowCount(); if($no > 0 ){echo " No of records = ".$no."<br><br>"; echo "<table style='border: solid 1px blue; background: red'>"; echo "<tr><th>sid</th><th>sname</th><th>age</th><th>Sex</th></tr>"; foreach ($dbo->query($query) as $row){ echo "<table style='border: solid 1px blue; background: gray'>"; echo "<tr><td>$row[id]</td><td>$row[name]</td><td>$row[Geburtstag]</td><td>$row[Staatsangehörigkeit]</td><td>$row[Kontaktdetails]</td><td>$row[Gemeinde]</td><td>$row[Beruf]</td><td>$row[Erfahrung]</td></tr>"; } echo "</table>"; }else { echo " No records found "; } }// End if form submitted echo "</td><td width='400' valign=top>"; echo " Full records here "; $query="select * from worker3"; echo "<table style='border: solid 1px blue; background: red'>"; echo "<tr><th><ID</th><th>Name</th><th>Geburtstag</th><th>Staatsangehoerigkeit</th><th>Kontaktdetails</th><th>Gemeinde</th><th>Beruf</th><th>Erfahrung</th></tr>"; foreach ($dbo->query($query) as $row){ echo "<table style='border: solid 1px blue; background: gray'>"; echo "<tr><td>$row[id]</td><td>$row[name]</td><td>$row[Geburtstag]</td><td>$row[Staatsangehörigkeit]</td><td>$row[Kontaktdetails]</td><td>$row[Gemeinde]</td><td>$row[Beruf]</td><td>$row[Erfahrung]</td></tr>"; } echo "</table>"; echo "</td></tr></table>"; ?> <center> Return to <a href=search-keyword.php>Search Keyword</a> <br><br><a href='http://www.eanda-group.com'>Here we are</a></center> </body> </html>
  5. Thanks guys, your input was really helpful. best wishes,
  6. Hi QuickOldCar, thanks a lot for your help. I tried to fix the problem as you adviced. Unfortunately, occured another one regarding mysql_fetch_array ( ) function (Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in C:\wamp\www\showDetails1.php on line 46). here is the improve code: <?php $link = mysqli_connect("localhost","root","", "home_work"); //mysql_select_db("home_work",$link); $sql = "SELECT * FROM dropdown "; $aResult = mysqli_query($link, $sql); if($_REQUEST['frm_action'] == 3) { if ($_REQUEST['cust_id'] == 0) { $id = $_REQUEST['cust_id']; $sqlCustomer = "SELECT * FROM dropdown "; } else { $id = $_REQUEST['cust_id']; $sqlCustomer = "SELECT * FROM dropdown WHERE id ='$id'"; } $aCustomer = mysqli_query($link, $sqlCustomer); } ?> <html> <head> <script type="text/javascript"> function changeSID() { oForm = eval(document.getElementById("frmForm")); iCustomerId = document.getElementById("sid").value; url = "showDetails1.php?frm_action=3&cust_id=" +iCustomerId; document.location = url; } </script> </head> <body> <form name="frmForm" id="frmForm" > <table border="0" cellspacing="2" cellpadding="2" width="40%"> <tr> <td align="right" ><strong>Sid</strong></td> <td align="left"><select name="sid" id="sid" onchange="javascript:changeSID();"> <option value="">Select</option> <option value="0">All</option> <?php $sid1 = $_REQUEST['cust_id']; while($rows=mysql_fetch_array($sqlCustomer, MYSQL_ASSOC)) { $id = $rows['id']; $sid = $rows['sid']; if($sid1 == $id) { $chkselect = 'selected'; } else { $chkselect =''; } ?> <option value="<?php echo $id;?>"<?php echo $chkselect;?>><?php echo $sid;?></option> <?php } ?> </td> </tr> <?php if($_REQUEST['frm_action'] == 3) { ?> <tr> <td colspan="2"> <table style="border:1px solid #003366;" cellspacing="2" cellpadding="2" width="100%" bgcolor="#003366"> <tr bgcolor="#EFEFEF"> <td><b><font color='Red'>Sid</font></b></td> <td><b><font color='Red'>Sname</font></b></td> <td><b><font color='Red'>Age</font></b></td> </tr> <?php while($row1 = @mysql_fetch_array($aCustomer,MYSQL_ASSOC)) { $sid = $row1['sid']; $sname = $row1['sname']; $age = $row1['age']; ?> <tr bgcolor="#FFFFFF"> <td><b><font color='#663300'><?php echo $sid;?></font></b></td> <td><b><font color='#663300'><?php echo $sname;?></font></b></td> <td><b><font color='#663300'><?php echo $age;?></font></b></td> </tr> <?php } ?> </table> </td> </tr> <?php } ?> </table> </form> </body> </html> cheers,
  7. Hello everyone, I'm a newbie in PHP thus have an issue running the following code. it always says (Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\showDetails1.php on line 5) or see attached image. in this code I try to inquiry data from a table using a dropdow list. Is there anyone of help? any help will be appreciated. <?php $link = mysqli_connect("localhost","root","", "home_work"); //mysql_select_db("home_work",$link); $sql = "SELECT * FROM dropdown "; $aResult = mysql_query($sql); if($_REQUEST['frm_action'] == 3) { if ($_REQUEST['cust_id'] == 0) { $id = $_REQUEST['cust_id']; $sqlCustomer = "SELECT * FROM dropdown "; } else { $id = $_REQUEST['cust_id']; $sqlCustomer = "SELECT * FROM dropdown WHERE id ='$id'"; } $aCustomer = mysql_query($sqlCustomer); } ?> <html> <head> <script type="text/javascript"> function changeSID() { oForm = eval(document.getElementById("frmForm")); iCustomerId = document.getElementById("sid").value; url = "showDetails1.php?frm_action=3&cust_id=" +iCustomerId; document.location = url; } </script> </head> <body> <form name="frmForm" id="frmForm" > <table border="0" cellspacing="2" cellpadding="2" width="40%"> <tr> <td align="right" ><strong>Sid</strong></td> <td align="left"><select name="sid" id="sid" onchange="javascript:changeSID();"> <option value="">Select</option> <option value="0">All</option> <?php $sid1 = $_REQUEST['cust_id']; while($rows=mysql_fetch_array($aResult,MYSQL_ASSOC)) { $id = $rows['id']; $sid = $rows['sid']; if($sid1 == $id) { $chkselect = 'selected'; } else { $chkselect =''; } ?> <option value="<?php echo $id;?>"<?php echo $chkselect;?>><?php echo $sid;?></option> <?php } ?> </td> </tr> <?php if($_REQUEST['frm_action'] == 3) { ?> <tr> <td colspan="2"> <table style="border:1px solid #003366;" cellspacing="2" cellpadding="2" width="100%" bgcolor="#003366"> <tr bgcolor="#EFEFEF"> <td><b><font color='Red'>Sid</font></b></td> <td><b><font color='Red'>Sname</font></b></td> <td><b><font color='Red'>Age</font></b></td> </tr> <?php while($row1 = @mysql_fetch_array($aCustomer,MYSQL_ASSOC)) { $sid = $row1['sid']; $sname = $row1['sname']; $age = $row1['age']; ?> <tr bgcolor="#FFFFFF"> <td><b><font color='#663300'><?php echo $sid;?></font></b></td> <td><b><font color='#663300'><?php echo $sname;?></font></b></td> <td><b><font color='#663300'><?php echo $age;?></font></b></td> </tr> <?php } ?> </table> </td> </tr> <?php } ?> </table> </form> </body> </html>
  8. Hi, we are a charity organization helping refuges in Europe to find jobs via presenting there ability and experience to the employers that close to them. thus would like to create a simple database on a friendly front end that allows any refuge to register and inter the following data (name, sure name, date of berth, country of origin, phone, email, Street, recent city with ZIP code, education/occupation, experience, attached CV if available). After submitting these data into database, any employer should be able to see chick out people registered with there occupation and experience to choose from them. Furthermore, then any employer should be able to search this table (through two drop down menus) regarding country, city of residence, and education. we need the code only and we will be able to manage the rest. hope you help us to achieve this work. we able to pay something for this help. of course we're ready to pay an amount of money for this work. Best wishes,
  9. Hi, we are a charity organization helping refuges in Europe to find jobs via presenting there ability and experience to the employers that close to them. thus would like to create a simple database on a friendly front end that allows any refuge to register and inter the following data (name, sure name, date of berth, country of origin, phone, email, Street, recent city with ZIP code, education/occupation, experience, attached CV if available). After submitting these data into database, any employer should be able to see chick out people registered with there occupation and experience to choose from them. Furthermore, then any employer should be able to search this table (through two drop down menus) regarding country, city of residence, and education. we need the code only and we will be able to manage the rest. hope you help us to achieve this work. we able to pay something for this help. of course we're ready to pay an amount of money for this work. Best wishes,
  10. Hi Techscript, we are a charity organization helping refuges in Europe to find jobs via presenting there ability and experience to the employers that close to them. thus would like to create a simple database on a friendly front end that allows any refuge to register and inter the following data (name, sure name, date of berth, country of origin, phone, email, Street, recent city with ZIP code, education/occupation, experience, attached CV if available). After submitting these data into database, any employer should be able to see chick out people registered with there occupation and experience to choose from them. Furthermore, then any employer should be able to search this table (through two drop down menus) regarding country, city of residence, and education. we need the code only and we will be able to manage the rest. hope you help us to achieve this work. we able to pay something for this help. of course we're ready to pay an amount of money for this work. Best wishes,
  11. Hi everyone, I'm not related to PHP at all and you might find this inquiry is strange. we are a charity organization helping refuges in Europe to find jobs via presenting there ability and experience to the employers that close to them. thus would like to create a simple database on a friendly front end that allows any refuge to register and inter the following data (name, sure name, date of berth, country of origin, phone, email, Street, recent city with ZIP code, education/occupation, experience, attached CV if available). After submitting these data into database, any employer should be able to see chick out people registered with there occupation and experience to choose from them. Furthermore, then any employer should be able to search this table (through two drop down menus) regarding country, city of residence, and education. we need the code only and we will be able to manage the rest. hope you help us to achieve this work. we able to pay something for this help. of course we're ready to pay an amount of money for this work. thanks in advance.
  12. We're ready to pay for it
  13. Hi everyone, I'm not related to PHP at all and you might find this inquiry is strange. we are a charity organization helping refuges in Europe to find jobs via presenting there ability and experience to the employers that close to them. thus would like to create a simple database on a friendly front end that allows any refuge to register and inter the following data (name, sure name, date of berth, country of origin, phone, email, Street, recent city with ZIP code, education/occupation, experience, attached CV if available). After submitting these data into database, any employer should be able to see chick out people registered with there occupation and experience to choose from them. Furthermore, then any employer should be able to search this table (through two drop down menus) regarding country, city of residence, and education. we need the code only and we will be able to manage the rest. hope you help us to achieve this work. thanks in advance.
×
×
  • 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.