[Solved] mysql reporting syntax error

[ad_1] Put your query with quotes: $query = “INSERT INTO historial(`titulo_his`, `autor_his`, `editorial_his`, `isbn_his`, `color_his`, `fecha_inicio_his`, `fecha_final_his`, `idusuarios_his`, `codlibros_his`) VALUES(‘{$tit}’, ‘{$aut}’, ‘{$edit}’, ‘{$isbn}’, ‘{$color}’, ‘{$fechaP}’, ‘{$fecha}’, ‘{$_SESSION[‘idusuarios’]}’, ‘{$libro}’)”; The problem is that you are trying to insert strings without enclosing them into quotes, so the query will fail PS: And don’t use mysql_* functions the … Read more

[Solved] Get PHP associative array from MySQL

[ad_1] Use mysql_fetch_assoc instead of mysql_fetch_row. GetRowFromDb(“`id`,`name`,`email`”, ” WHERE `id`=’1′”, “database1”, “table1″); function GetRowFromDb ($column, $condition, $database, $table) { $target=”`$database`.`$table`”; $query=”SELECT $column FROM $target $condition”; $indexedrow=mysql_fetch_assoc(mysql_query($query)); return $indexedrow; } [ad_2] solved Get PHP associative array from MySQL

[Solved] Issue with my website url [closed]

[ad_1] You need to move the home.html file in to the start directory, in other words not in any folders or just out of the OBI1.0 folder, and rename it index.html. Then you can go to obiventures.com / http://obiventures.com / http://obiventures.com/ and it will be there. Oh, and nice website by the way. 0 [ad_2] … Read more

[Solved] MySQL Query issue with select [closed]

[ad_1] Another approach to “join” two tables: SELECT proposal.proposalID, client.name FROM client, proposal WHERE proposal.clientID = client.id; Warning: I didn’t test this. In order to understand what’s going on, I suggest you learn more about SQL Joins. Some links to get you started: http://www.w3schools.com/sql/sql_join.asp http://en.wikipedia.org/wiki/Join_%28SQL%29 https://www.google.com/search?q=sql+join 2 [ad_2] solved MySQL Query issue with select [closed]

[Solved] Code throws warning: Undefined index in GET array [duplicate]

[ad_1] Its because if the ?page paramater isn’t set in the URL it will throw that error. Replace with the following code: $page = (isset($_GET[‘page’])) ? $_GET[‘page’] : ”; // gets the variable $page ****** //global $page; if (!empty($page)){ include($page); } // if $page has a value, include it else { include(“home.php”); } // otherwise, … Read more

[Solved] I want a function to remove numbers higher than 5000 in a string [closed]

[ad_1] PHP < 5.3: preg_replace_callback(‘/\s*\d+\s*/’, create_function(‘$a’, ‘return trim($a[0]) > 5000? ” ” : $a[0];’), $input); PHP >= 5.3 (closure support): preg_replace_callback(‘/\s*\d+\s*/’, function ($a) { return trim($a[0]) > 5000? ” ” : $a[0]; }, $input); [ad_2] solved I want a function to remove numbers higher than 5000 in a string [closed]

[Solved] PHP Why does this work? [duplicate]

[ad_1] <?=?> is a Short Tag for echo(); According to PHP Outputs all parameters. echo is not actually a function (it is a language construct), so you are not required to use parentheses with it. echo (unlike some other language constructs) does not behave like a function, so it cannot always be used in the … Read more

[Solved] Removing unwanted key/value pair in php array? [closed]

[ad_1] check this, use is is_numeric to check number or string. $data = array(“0″=>”1″,”id”=>”1″,”1″=>”mani”,”name”=>”mani”,”2″=>”ssss”,”lname”=>”ssss”); foreach ($data as $key => $val) { if(!is_numeric($key)) { $new_array[$key] = $val; } } print_r($new_array); OUTPUT : Array ( [id] => 1 [name] => mani [lname] => ssss ) DEMO 1 [ad_2] solved Removing unwanted key/value pair in php array? [closed]

[Solved] How to refactor frontend JS to Angular 2 to play nicely with PHP MVC backend? [closed]

[ad_1] Even tho you’re getting downvotes, let me help you to start a BIG journey if you’re willing to really do that. First, if your views are generated on the backend : “The most part of the HTML is rendered in the PHP backend.” According to that sentence, I imagine that you don’t have a … Read more

[Solved] Create a link while typing using Jquery [closed]

[ad_1] Although I do not want to make it your habit to take SO as a code for me site but this time here it is for you: var field = document.getElementById(“field”); var link = document.getElementById(“link”); field.onchange = function() { link.href = “http://www.example.com/?q=” + encodeURIComponent(field.value); console.log(link.href); }; Notice I did not code it for you … Read more

[Solved] Unique ID for year

[ad_1] The only way to be sure you have a unique Id in your data set is to test for it. $id = uniqid(2012); //returns a 13 character string plus it will append 2012 for 17 characters. $resultSet = //get dataSet from somewhere foreach($resultSet as $row) { if ($row[‘id’] = $id) { //do some stuff … Read more