[Solved] when i refresh will delete all records

[ad_1] try this code <?php $sql=”SELECT * FROM administrators”; $record=mysql_query($sql); function drop($id,$email){ $q=”DELETE FROM administrators WHERE id=’$id’ AND email=”$email””; mysql_query($q); header(“Refresh:0″); } if (isset($_GET[‘drop’])) { $id=$_GET[‘id’];$email=$_GET[’email’]; drop($id,$email); } ?> <title>Admins Table</title> <style> table, th, td { border: 2px solid black; border-collapse: collapse; } #creating { font:bold; font-size:1.6em; } </style> <a href=”https://stackoverflow.com/questions/35550971/cadmin.php” id=’creating’>Create New Admin</a><br/><br/> <table … Read more

[Solved] Fetching records from MySQL database with PHP to populate a drop down list

[ad_1] You are messing up your single and double quotes. Try this: <?php include(“db_config.php”); $sql=”SELECT * FROM brojevi”; $result=mysqli_query($connection,$sql); echo ‘<select name=”dropdown” size=”1″>’; echo ‘<option value=”choose”>-choose-</option>’; while($row=mysqli_fetch_array($result)){ $id = $row[‘id’]; $broj = $row[‘brojevi’]; echo ‘<option value=”‘ . $id . ‘”>’ . $broj . ‘</option>’; } echo ‘</select>’; ?> When using html tags inside your echo, … Read more

[Solved] Mysql Query from an array [duplicate]

[ad_1] Use implode(). $yourArray = array_map(“mysql_real_escape_string”, $yourArray); $query = “SELECT * FROM user_detail WHERE user_id='”; $query .= implode($yourArray, “‘ OR user_id='”); $query .= “‘”; Or indeed, use the SQL IN keyword: $yourArray = array_map(“mysql_real_escape_string”, $yourArray); $query = “SELECT * FROM user_detail WHERE user_id IN (‘”; $query .= implode($yourArray, “‘,'”); $query .= “‘)”; 0 [ad_2] solved … Read more

[Solved] Error when running SQL syntax

[ad_1] The error: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given is almost always because you’ve tried to execute a query and it’s failed for some reason, but you’ve continued on blindly anyway. Upon failure, mysqli_query will return false rather than a mysqli_result and, if you then attempt to use that boolean false … Read more

[Solved] Google Maps – markers from database displaying information from the last row only

[ad_1] You only have one infowindow, when you open it, it displays the last content you gave it. Change your click listener from: google.maps.event.addListener(marker, ‘click’, function() { infowindow.open(map,marker); }); To (set the new content before you open it): google.maps.event.addListener(marker, ‘click’, function() { //set the content of infoWindow infowindow.setContent(eventContent[0]); infowindow.open(map,marker); }); working fiddle code snippet: var … Read more

[Solved] Move Pound £ symbol from after a number to before it

[ad_1] This should work: <?php $re=”/(\d{1,})/m”; $str=”<b>100£</b> was £160″; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); if(count($matches)>0 && isset($matches[0][0]) && isset($matches[1][0])) { echo(sprintf(‘<b>£%d</b> was £%d’, $matches[0][0], $matches[1][0])); } 0 [ad_2] solved Move Pound £ symbol from after a number to before it

[Solved] Log in Script not returning the values from MYSQL [closed]

[ad_1] Your query is badly formed. Try $query = mysql_query(“SELECT * FROM users WHERE email=”” . $username . “” AND password='” . $password . “‘);” Also, note that the mysql_ functions are deprecated. Update your code to mysqli or PDO. 1 [ad_2] solved Log in Script not returning the values from MYSQL [closed]

[Solved] How to consume a json object in PHP

[ad_1] There are two steps to take: 1. load the JSON data 2. understand the JSON data 3. load the data in a database Your code appears to load the JOSN data using curl. In my experience, curl is powerful but complex for beginners. Probable file_get_contents() http://php.net/manual/en/function.file-get-contents.php works as well and is more easy. e.g. … Read more

[Solved] Set PHP variable value from a Javascript Variable value without refresh [duplicate]

[ad_1] Actually php is server side scripting language (that runs at server) and javascript is basically client side programming language (which runs in the browser) so you can’t set a php variable from javascript. Look at these tutorials php and javascript. But using ajax (javascript) you can pass javascript variables to php and can use … Read more

[Solved] Geeting data from post in PHP and insert into table [closed]

[ad_1] I think your query statement will be like this $query = “INSERT into AppointmentDataSync (ProviderNPI,PatientID,FileURL,FileType,DataSyncID) VALUES(‘”.$providernpi.”‘,'”.$patientid.”‘,'”.$fileurl.”‘,'”.$filetype.”‘,'”.$datasynid.”‘)”; EDIT mysql_query($query); printf(“Records inserted: %d\n”, mysql_affected_rows()); 8 [ad_2] solved Geeting data from post in PHP and insert into table [closed]

[Solved] php dynamically generate new web page from link [closed]

[ad_1] Assuming each of the articles has its ID. Change the link to go to a dynamic page, passing that ID: “<div class=\”title\”><a href=\”dynamic_page.php?id=$result[id]\”>$resultphp dynamically generate new web page from link [closed]</a></div>” Then create a dynamic_page.php that accepts that ID and generates the article as follows: if (isset($_GET[‘id’])) { $id = mysql_real_escape_string($_GET[‘id’]); $q = “SELECT … Read more

[Solved] how to Retrieve date from xml file [closed]

[ad_1] You can use the xml_parse_into_struct() function for an easy to parse XML. <?php $simple = “<para><note>simple note</note></para>”; $p = xml_parser_create(); xml_parse_into_struct($p, $simple, $vals, $index); xml_parser_free($p); echo “Index array\n”; print_r($index); echo “\nVals array\n”; print_r($vals); ?> source [ad_2] solved how to Retrieve date from xml file [closed]