Lynk
-
Posts
12 -
Joined
-
Last visited
Never
Posts posted by Lynk
-
-
no ;) i wasnt offended, i really appreciate the help, let me give this a try :D
edit: no, still nothing :'( :'( :'( :'( here is the EXACT code i used...
[code]
<?php include ('../nect.php');?>
<?php
if (isset($_POST['submit'])) {
$q = mysql_real_escape_string(trim($_POST['q']));
$sort = mysql_real_escape_string(trim($_POST['sort']));
if ((!$q) || (!$sort)) {
echo "You did not submit a required field";
exit(1);
}
$select5 = "SELECT * FROM lynk_fm WHERE artist LIKE '%$q%' ORDER BY id $sort";
$obj5 = mysql_query($select5) or die(mysql_error());
while($row5 = mysql_fetch_assoc($obj5)){
echo '' . $row5['song'] . '<br />';
}
}
?>
<form action="<?=$PHP_SELF?>" name="form_search">
<table width="100%" style="border:1px dashed darkgray;">
<tr> <td width="222" bgcolor="#EEEEEE">Music search</td></tr>
<tr><td valign="top"><input name="q" type="text" class="INPUT" onFocus="if(this.value=='Tiesto')this.value='';" value="Tiesto">
<select name="sort" class="I_send">
<option value="DESC">Newest first</option>
<option value="ASC">Oldest first</option>
</select>
<input type="submit" name="submit" class="I_send" value="Go >"> Search for music on Lynk Fm <br />
</td></tr></table>
</form>
[/code] -
[quote author=tomfmason link=topic=104462.msg416707#msg416707 date=1155720838]
well it is not silly. You just don't know. You need something like this
[code]
<?php
if (isset($_POST['submit'])) {
//preform your code here
}
?>
<!--html here-->
[/code]
[/quote]
i actually do know, i DID have that the first time, that didnt work, so i switched to something more simpler...
but i but it back now, you can check it here: http://lynkonline.atlas2wielers.nl/lynk_fm/lynk_fm2.php -
anyway, im really stuck this time...
i just know its probably something soo silly... -
[quote author=Lynk link=topic=104462.msg416700#msg416700 date=1155720253]
now it shows everything with tiesto in it...
regardeless of the form...
[/quote]no wait, it shows everything -
no man, still nothing...the page just loads quickly, and the url shows this
http://lynkonline.atlas2wielers.nl/lynk_fm/lynk_fm2.php?q=Tiesto&sort=DESC&submit=Go+%3E -
[font=tahoma]i wrote this little thingie, when i move the [b]echo[/b] part, out of the [b]if (){ }[/b] part way below,
it works, but i just cant seem to get it working with the [b]if[/b]....[/font]
anyone?
[code]<? function select5(){
$select5 = "SELECT * FROM lynk_fm WHERE artist LIKE '%$q%' ORDER BY id $sort";
$obj5 = mysql_query($select5) or die($MySQLError.mysql_error());
return $obj5; } ?>
<form action="<?=$PHP_SELF?>" name="form_search">
<table width="100%" style="border:1px dashed darkgray;">
<tr> <td width="222" bgcolor="#EEEEEE">Music search</td></tr>
<tr><td valign="top"><input name="q" type="text" class="INPUT" onFocus="if(this.value=='Tiesto')this.value='';" value="Tiesto">
<select name="sort" class="I_send">
<option value="DESC">Newest first</option>
<option value="ASC">Oldest first</option>
</select>
<input type="submit" class="I_send" value="Go >"> Search for music on Lynk Fm <br />
</td></tr></table>
</form>
<? if($_POST['q'] != "") {?>
<? $res5 = select5(); while($row5 = mysql_fetch_object($res5)) { echo "$row5->song<br>"; } ?>
<? } ?>[/code] -
yeey, i got it working, you can remove this topic so :P ;D ;D ;D ;D
-
nah, nothing, not i get this error when i update...
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE artist='Busta Rhymes' AND title='Touch It (Remix part III)' SET score='10'' at line 1 -
ill check it out thanks fot the tips. can you find anything obviously wrong with the code?
i know its probably something very silly, but i just cant find out what it is... ::) -
[quote author=DocSeuss link=topic=102373.msg406207#msg406207 date=1154298714]
The correct syntax for checking if values are equal in an if statment is ==
if($value1 == $value2)
But that is going to make your update code run every time.
Also I'm not sure how your $song[0] is connected to the current song if there is a problem here then you will never actually find a match in the database to update.
[/quote] thanks for your reply :D the $song[0] request the current song on winamp, i have a code that wil print the current song, you can see it working here: http://lynkonline.atlas2wielers.nl/sc_song/now.php -
ok, here the deal, i want users to rate the current song playing, so, if the song isnt in the database it wil be created, however, i want it to update that same song if it is voted again...but i cant get it to update :'( ...some help would be REALLY appreciated...thanks :D
http://lynkonline.atlas2wielers.nl/index.temp.php
<?
/* $song[0] is connected to my winamp. it shows the current song playing! */
?>
<? if(isset($_POST['form'])){?>
<?php function lynkfm_rate(){$select_data = "SELECT * FROM lynk_fm WHERE song='$song[0]' LIMIT 1";
$object = mysql_query($select_data) or die($MySQLError.mysql_error()); return $object; } $res99 = lynkfm_rate();
$show = mysql_fetch_object($res99); $new_score = $show->score + $score2 ; $new_vote = $show->votes + 1 ; ?>
<? if( $show->song = "$song[0]") {mysql_query("UPDATE lynk_fm SET score='$new_score', votes='$new_vote' ");
echo"new score: $show->score"; }
elseif ($show->song != "$song[0]") {mysql_query("INSERT INTO lynk_fm (id,date,artist,title,song,score,votes) VALUES ('', '$date_now', '".htmlspecialchars($artist)."', '".htmlspecialchars($title)."', '".htmlspecialchars($song[0])."', '$score2', '$votes') ") or die(mysql_error()); echo"$show->title"; }
else{echo "UPDATE DIDNT WORK! !!";}?>
<? } ?>
<form method="post" name="lynk_fm" action="<?=$PHP_SELF?>">
<input type="hidden" name="form" value="1">
<select name="score2">
<option disabled>Rate</option>
<option value="10">10</option>
<option value="9">9</option>
<option value="8">8</option>
<option value="7">7</option>
<option value="6">6</option>
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
<option value="1">1</option>
</select> <input name="Submit" type="submit" class="I_send" value="Go >" />
Rate this song!</form>
simple table search!
in PHP Coding Help
Posted
anyway, im tring to get this fixed for my [url=http://lynkonline.atlas2wielers.nl/preloader.php]still in beta site[/url]