Jump to content

Help Me Please!!!


smd8061

Recommended Posts

I am doing a project for school that requires a search function and i keep getting an error through putty that says: Undifined Offset 3 on line 25.

 

I am trying to search a database with keywords. By the way I do not really know how i would post the results.

 

Here is my code:

 

<html>

 

<body>

 

<form name="form" action="" method="POST">

Search: <input type="text" name="$s" /> <br />

<input type="submit" name="submitbutton" />

<input type="reset" name="resetbutton" />

</form>

 

<?php

 

 

// Connecting, selecting database

$link = mysql_connect('HOST', 'USERNAME', 'PASSWORD')

    or die('Could not connect: ' . mysql_error());

mysql_select_db('software') or die('Could not select database');

 

// Performing SQL query

$s = @$_GET['$s'] ;

$query = "SELECT * FROM Master WHERE Keyword = '$s' ";

$result = mysql_query($query) or die('Query failed: ' . mysql_error());

 

//printing results

print "RESULTS: $_POST[$result] ";  <---------THIS IS LINE 25

 

?>

 

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/85379-help-me-please/
Share on other sites

<html>
<body>
<form name="form" action="" method="POST">
Search: <input type="text" name="key" />
<input type="submit" name="submitbutton" />
<input type="reset" name="resetbutton" />
</form>

<?php


// Connecting, selecting database
$link = mysql_connect('HOST', 'USERNAME', 'PASSWORD')
    or die('Could not connect: ' . mysql_error());
mysql_select_db('software') or die('Could not select database');

// Performing SQL query
$s = @$_GET['$s'] ;
$query = "SELECT * FROM Master WHERE Keyword like '".$_POST['key']."' ";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while($row= mysql_fetch_assoc($result)){
echo "RESULTS:". $_POST['field here'];// note put a proper field name on that array index 
}											// this are your table fields
?>

</body>
</html>

there and this is not MSSQL this is simple php mysql issue it should be on php help board

Link to comment
https://forums.phpfreaks.com/topic/85379-help-me-please/#findComment-436051
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.