jandrews
Members-
Posts
25 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
jandrews's Achievements
Newbie (1/5)
0
Reputation
-
A letter cannot be a number. Lol Ok character U know what I mean. Thanks tho, that works. Only thing that needed changing was " to '
-
Hi all, I need to know how to pull all fields from a database where the first letter is any number. How would i do this?
-
There is only 1 query and it does have or die(mysql_error()); after it. hmmmm.... I can't figure this one out
-
No That doesn't work either.
-
tried to rearrange that like you said, but it doesnt seem to be that
-
Hey, Does anyone know why this query would only return one row in a table? <?php require_once('Connections/top50.php'); ?> <?php $maxRows_top50 = 10; $pageNum_top50 = 0; if (isset($_GET['pageNum_top50'])) { $pageNum_top50 = $_GET['pageNum_top50']; } $startRow_top50 = $pageNum_top50 * $maxRows_top50; mysql_select_db($database_top50, $top50); $query_top50 = "SELECT hits, title_music, playlist_music FROM flamplayer_musics ORDER BY hits DESC"; $query_limit_top50 = sprintf("%s LIMIT %d, %d", $query_top50, $startRow_top50, $maxRows_top50); $top50 = mysql_query($query_limit_top50, $top50) or die(mysql_error()); $row_top50 = mysql_fetch_assoc($top50); if (isset($_GET['totalRows_top50'])) { $totalRows_top50 = $_GET['totalRows_top50']; } else { $all_top50 = mysql_query($query_top50); $totalRows_top50 = mysql_num_rows($all_top50); } $totalPages_top50 = ceil($totalRows_top50/$maxRows_top50)-1; mysql_free_result($top50); ?> </p> <table width="100%" cellpadding="3" cellspacing="2"> <tr> <td align="center" bgcolor="#121212"><div align="center">Song</div></td> <td align="center" bgcolor="#121212"><div align="center">Band</div></td> <td align="center" bgcolor="#121212">Plays</td> </tr> <?php do { ?> <tr> <td bgcolor="#666666"><a href="../band.php?music=<?php echo urlencode($row_top50['playlist_music']); ?>" class="style2"><a href="backing_track.php?track=<?php echo urlencode($row_top50['title_music']); ?>"> <?php echo ucfirst($row_top50['title_music']); ?></a></td> <td bgcolor="#666666"><a href="../band.php?music=<?php echo urlencode($row_top50['playlist_music']); ?>" class="style2"><?php echo ucfirst($row_top50['playlist_music']); ?></a></td> <td align="center" bgcolor="#666666"><?php echo $row_top50['hits']; ?></td> </tr> <?php } while ($row_top50 = mysql_fetch_assoc($top50)); ?> </table> Any help would be great.
-
Thank you very much that works, Here is the code i used: <?php $select = mysql_query("UPDATE`example_table` SET `hits` = `hits`+1 WHERE title_music='{$_GET['track']}'") or die(mysql_error()); ?> :) :)
-
Hey guys, this can easily sound more complicated than it is, so I'l try to keep it simple. Im building a site that uses dynamic data from a Mysql database and I want the 'hit' column in my existing database table to increment by 1 when a row is queried. Here is my code ( I know all the connections stuff isn't there because they are in a different file which is being included on the same page) <?php $select = mysql_query("UPDATE `example_table` `SET `hits` = `hits`+1 WHERE title_music='['track']'"); ?> As you might expect, it doesnt work. The '['track']' in the code is the url variable. Am I barking up the wrong tree? or is there a better way of doing this?
-
[SOLVED] How do I code an if statement in this way?...
jandrews replied to jandrews's topic in PHP Coding Help
Wow! We got there in the end. ... and you are right, the trim() isn't needed, actually, it stops the code from working. Thanks Premiso for your time and help best wishes -
[SOLVED] How do I code an if statement in this way?...
jandrews replied to jandrews's topic in PHP Coding Help
All I simply want the page to do is echo the error message if the 'Tab' field (which is a text field in my database) is empty ie doesn't contain any data. If however the 'Tab' field does contain text, it is echoed out. simples... -
[SOLVED] How do I code an if statement in this way?...
jandrews replied to jandrews's topic in PHP Coding Help
woops, wrong code. here it is... <?php require_once('Connections/artists.php'); require_once('Connections/Tabs.php'); $colname_filename = "-1"; if (isset($_GET['track'])) { $colname_filename = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']); } $colname_artists = "-1"; if (isset($_GET['track'])) { $colname_artists = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']); } $colname_Tab = "-1"; if (isset($_GET['track'])) { $colname_Tab = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']); } mysql_select_db($database_Tabs, $Tabs); $query_Tab = sprintf("SELECT Tab FROM flamplayer_musics WHERE title_music LIKE '%%%s%%'", $colname_Tab); $Tab = mysql_query($query_Tab, $Tabs) or die(mysql_error()); $row_Tab = mysql_fetch_assoc($Tab); $totalRows_Tab = mysql_num_rows($Tab); if (mysql_num_rows($Tab) > 0) { echo $row_Tab['Tab']; } else { echo 'no tabs!'; } ?> -
[SOLVED] How do I code an if statement in this way?...
jandrews replied to jandrews's topic in PHP Coding Help
Yes sorry, here is the full code... <?php require_once('Connections/artists.php'); require_once('Connections/Tabs.php'); $colname_filename = "-1"; if (isset($_GET['track'])) { $colname_filename = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']); } $colname_artists = "-1"; if (isset($_GET['track'])) { $colname_artists = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']); } $colname_Tab = "-1"; if (isset($_GET['track'])) { $colname_Tab = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']); } mysql_select_db($database_Tabs, $Tabs); $query_Tab = sprintf("SELECT Tab FROM flamplayer_musics WHERE title_music LIKE '%%%s%%'", $colname_Tab); $Tab = mysql_query($query_Tab, $Tabs) or die(mysql_error()); $row_Tab = mysql_fetch_assoc($Tab); $totalRows_Tab = mysql_num_rows($Tab); if (mysql_num_rows($Tab) > 0) { <?php if (mysql_num_rows($Tab) > 0) { echo $row_Tab['Tab']; } else { echo 'no tabs!'; } ?> } else { echo 'no tabs!'; } ?> -
[SOLVED] How do I code an if statement in this way?...
jandrews replied to jandrews's topic in PHP Coding Help
Thanks for the help so far guys. So now i am using this code: <?php require_once('Connections/artists.php'); require_once('Connections/Tabs.php'); $colname_filename = "-1"; if (isset($_GET['track'])) { $colname_filename = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']); } $colname_artists = "-1"; if (isset($_GET['track'])) { $colname_artists = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']); } $colname_Tab = "-1"; if (isset($_GET['track'])) { $colname_Tab = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']); } mysql_select_db($database_Tabs, $Tabs); $query_Tab = sprintf("SELECT Tab FROM flamplayer_musics WHERE title_music LIKE '%%%s%%'", $colname_Tab); $Tab = mysql_query($query_Tab, $Tabs) or die(mysql_error()); $row_Tab = mysql_fetch_assoc($Tab); $totalRows_Tab = mysql_num_rows($Tab); if (mysql_num_rows($Tab) > 0) { include_once('tab.php'); } else { echo 'no tabs!'; } ?> ... and it displays the tabs for the rows that have tabs in their text field but for the ones without, the error message is not displaying. -
[SOLVED] How do I code an if statement in this way?...
jandrews replied to jandrews's topic in PHP Coding Help
A 'tab' is a text field in the database. A tab is basically guitar music notation which is why it is in text. The tab shows on the page on the url variable '?track=example_song_title' This works fine for rows which have a tab in their tab field but for those that don't, I want to include the message, 'no tabs!'. -
[SOLVED] How do I code an if statement in this way?...
jandrews replied to jandrews's topic in PHP Coding Help
Just this for now but i will later use this file for other more complex things. <?php { echo ($row_Tab['Tab']); } ?>