Pass to ID

Very new to php & mysql.

Here is what I’m trying to do:

When you click on records it goes to domain.com/record/id and only displays the record of that id.

Here is what is happening: I can get all records if i remove $id but receiving nothing with the code below. I know that my mysql code is old. I am updating. Thanks

[php]<?php

case ‘records’: $this-> get_records ($callParams[1]);

private function get_records($id)
{
$result = get_records_info ($id) ;
if(count($result) > 0)
$this->response($this->text/html($result), 200);
else
$this->response(’’,204);
}

function get_records_info ($id){
$result = mysql_query (“SELECT * FROM records where id = ’ “.$id.” ’ “)
or die(mysql_error());
while($records = mysql_fetch_array( $result )) {
echo “

” .$records[‘records_name’]. “
”;
echo “
info:” .$records[‘w’]. $records[‘l’]. $records[‘d’]. $records[‘k’].”
”;
echo “
info2:”.$records[‘info2’]."
";
}

}

?>[/php]

Remove the backticks…
[php]records[/php] etc…

if $id is an int you don’t need the quotes.
[php]’ “.$id.” '[/php] change to [php]".$id."[/php]

Hope that helps,
Red :wink:

no luck… still not working. i can only get all records. i cannot get record by ID… literally been at this for 4 days.

Sponsor our Newsletter | Privacy Policy | Terms of Service