[Solved] error mysql_query() expects parameter 1 to be string

Your query should look like this: $insertData = “INSERT INTO facebook (fdId, fullName, email, dob, location, gender, postId) VALUES (‘”.$fbId.”‘,'”.$fullName.”‘,'”.$email.”‘,'”.$new_date.”‘,'”.$location.”‘,'”.$gender.”‘,'”.$postId.”‘)”; mysql_select_db(‘noskunk1_facebook’,$vdb); $result = mysql_query($insertData); if ($result)) { echo “New record created successfully”; } else { echo “Error: ” . $insertData . “<br>” . mysql_error($vdb); } but consider using pdo 3 solved error mysql_query() expects parameter … Read more

[Solved] How to make HTML interact with a database? [closed]

You can’t make HTML directly interacting with database. You should create server-side application, which answer queries generated by HTML forms, JS queries, etc. I am PHP developer, I like this language, so I recommend you using it in your solution. You can read about connecting PHP to MySQL database here: http://www.w3schools.com/php/php_mysql_connect.asp There you have basic … Read more

[Solved] How to stop duplicating the data in database everytime the form loads?

I don’t understand the need of your “reports” table,… If I was you I’ll use only ShowData() with the query, like this public void ShowData() { con = new SqlConnection(@”Data Source=LAPTOP-KA7UGSG3;Initial Catalog=JAPoultry;Integrated Security=True”); con.Open(); da = new SqlDataAdapter(“SELECT Variety, SUM(Quantity) FROM Inventory GROUP BY Variety”, con); dt = new DataTable(); da.Fill(dt); dgv_Reports.DataSource = dt; } … Read more

[Solved] add 1 day to date format YYYYMMDD when field name is greater or equal to 1200 [closed]

With the help of STR_TO_DATE and DATE_FORMAT function you can achieve this: SELECT DATE_FORMAT(STR_TO_DATE(dateUs,’%Y%m%d’) + INTERVAL HourMins+0 >= 1200 DAY ,’%Y%m%d’) AS dateLoc FROM your_table Demonstration: SET @str := ‘20160919’; SET @HOUR := ‘1215’; SELECT ( STR_TO_DATE(@str, ‘%Y%m%d’) + INTERVAL (@HOUR + 0) >= 1200 DAY ) AS date, DATE_FORMAT( STR_TO_DATE(@str, ‘%Y%m%d’) + INTERVAL (@HOUR … Read more

[Solved] Select database where datetime>now()? [closed]

Store now() in a variable and then compare using where clause. Also see this and this Update :<?php $timeZone=”Asia/Kolkata”; //variable for indian timezone date_default_timezone_set( $timeZone); //default timezone set to indian time $now = date(“m/d/y G.i:s”); echo $now; ?> Check for date functions in PHP 2 solved Select database where datetime>now()? [closed]

[Solved] How to get a particular cell from MySQL table using PHP? [closed]

<?php $conn = mysql_connect(‘localhost’, ‘mysql_user’, ‘mysql_password’); if (!$conn) { die(‘Could not connect: ‘ . mysql_error()); } mysql_select_db(‘database’); $result = mysql_query(‘select URL from table’); if (!$result) { die(‘Query failed: ‘ . mysql_error()); } echo mysql_result($result, 0); // outputs mysql_close($conn); ?> 0 solved How to get a particular cell from MySQL table using PHP? [closed]

[Solved] php mysql_fetch_array() error [duplicate]

when you run a DELETE command, I believe nothing is returned, thus you can’t mysql_fetch_array(). You would normally use that if you’re doing a SELECT. in this case, you’re deleting something, so just remove that loop, and echo(). solved php mysql_fetch_array() error [duplicate]

[Solved] How to make SQL Script like this? [closed]

You can try like following using GROUP BY and UNION ALL. select count(*) CT,Mark from TableName group by Mark union all select Count(*), ‘A+B’ as mark from TableName where mark in(‘A’,’B’) UNION ALL select Count(*), ‘A+C’ as mark from TableName where mark in(‘A’,’C’) union all select Count(*), ‘B+C’ as mark from TableName where mark in(‘B’,’C’) … Read more

[Solved] Update table, but make a new updated table? [closed]

your code mysql_query(“UPDATE prestataire SET (login=’$a’, passe=”$b” , email=”$c”,nom=’$d’, prenom=’$e’, adresse=”$f”, ville=”$g”, tel=”$h” )WHERE login = ‘$a’ )”); try like this $sql = “UPDATE prestataire SET (login=’$a’, passe=”$b” , email=”$c”,nom=’$d’, prenom=’$e’, adresse=”$f”, ville=”$g”, tel=”$h” )”; $request = mysql_query($sql); better way $sql = “UPDATE prestataire SET passe=”$b” , email=”$c”,nom=’$d’, prenom=’$e’, adresse=”$f”, ville=”$g”, tel=”$h” WHERE login=’$a'”; You … Read more

[Solved] Could someone explain this php mysql script? [closed]

This question does not really belong here, but I’ll answer it for the sake of closing the question without bothering moderators. // mysql query is executed $images = mysql_query(“Select URL from images where Category = ‘Management’ “); // empty array initialized $imagerow = Array(); // while there are results of the executed mysql query while … Read more