Jump to content

norman100

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

norman100's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Fenway i revised the query yet again and got it to work but $query="SELECT tracks.track_id, tracks.trackname, tracks.description, tracks.genre, tracks.duration, tracks.artist, tracks.filename, tracks.picture FROM tracks LEFT JOIN artistlibrary ON tracks.track_id = artistlibrary.track_id AND artistlibrary.username <> '$username' WHERE artistlibrary.track_id is null"; Now it just selects everything including the rows which are present within the artist library table thanks for your help n [!--quoteo(post=379599:date=Jun 3 2006, 07:19 AM:name=norman100)--][div class=\'quotetop\']QUOTE(norman100 @ Jun 3 2006, 07:19 AM) [snapback]379599[/snapback][/div][div class=\'quotemain\'][!--quotec--] Fenway thanks for your help! heres the commands ive copied from a output files # MySQL-Front Dump 2.5 # # Host: localhost Database: music # -------------------------------------------------------- # Server version 4.0.21-debug # # Table structure for table 'admin' # CREATE TABLE admin ( username varchar(50) NOT NULL default '0', password varchar(20) default NULL, email varchar(50) default NULL, forename varchar(50) default NULL, surname varchar(50) default NULL, PRIMARY KEY (username) ) TYPE=MyISAM COMMENT='Stores administrator details'; # # Dumping data for table 'admin' # INSERT INTO admin VALUES("morjarin", "blue", "nirmal@hotmail.com", "nirmal", "morjaria"); # # Table structure for table 'artistlibrary' # CREATE TABLE artistlibrary ( library_id bigint(100) unsigned NOT NULL default '0', track_id bigint(100) unsigned NOT NULL default '0', username varchar(100) NOT NULL default '', PRIMARY KEY (library_id) ) TYPE=MyISAM; # # Dumping data for table 'artistlibrary' # # # Table structure for table 'artists' # CREATE TABLE artists ( username varchar(50) NOT NULL default '0', password varchar(50) default NULL, forename varchar(50) default NULL, surname varchar(50) default NULL, email varchar(50) default NULL, website varchar(100) default NULL, PRIMARY KEY (username) ) TYPE=MyISAM COMMENT='Holds details about the artists '; # # Dumping data for table 'artists' # INSERT INTO artists VALUES("morjaria", "blues", "nirmals", "morjarias", "nirma@hotmail.coms", "www.google.co.uks"); # # Table structure for table 'members' # CREATE TABLE members ( username varchar(50) NOT NULL default '0', forename varchar(50) default NULL, surname varchar(50) default NULL, email varchar(50) default NULL, password varchar(20) default NULL, PRIMARY KEY (username) ) TYPE=MyISAM; # # Dumping data for table 'members' # INSERT INTO members VALUES("nirmal", "nirmals", "morjaria", "nirm@yahoo.co.uk", "blue"); # # Table structure for table 'memlibrary' # CREATE TABLE memlibrary ( libray_id bigint(100) NOT NULL auto_increment, track_id bigint(100) unsigned NOT NULL default '0', username varchar(100) NOT NULL default '', PRIMARY KEY (libray_id) ) TYPE=MyISAM COMMENT='Member library records'; # # Dumping data for table 'memlibrary' # # # Table structure for table 'tracks' # CREATE TABLE tracks ( track_id mediumint(3) unsigned NOT NULL auto_increment, trackname varchar(200) default NULL, description longblob, genre varchar(20) default NULL, duration varchar(50) default NULL, artist varchar(50) default NULL, filename varchar(100) default NULL, picture varchar(100) default NULL, PRIMARY KEY (track_id) ) TYPE=MyISAM COMMENT='Holds the details of current MP3 in the systems.'; # # Dumping data for table 'tracks' # [/quote]
  2. [!--quoteo(post=379527:date=Jun 2 2006, 10:21 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 2 2006, 10:21 PM) [snapback]379527[/snapback][/div][div class=\'quotemain\'][!--quotec--] Not sure -- looks ok to me. Dump some sample data as INSERT statements, and the CREATE TABLE output as well, and I'll take a look. I can't work with the existing output. [/quote] Fenway thanks for your help! heres the commands ive copied from a output files # MySQL-Front Dump 2.5 # # Host: localhost Database: music # -------------------------------------------------------- # Server version 4.0.21-debug # # Table structure for table 'admin' # CREATE TABLE admin ( username varchar(50) NOT NULL default '0', password varchar(20) default NULL, email varchar(50) default NULL, forename varchar(50) default NULL, surname varchar(50) default NULL, PRIMARY KEY (username) ) TYPE=MyISAM COMMENT='Stores administrator details'; # # Dumping data for table 'admin' # INSERT INTO admin VALUES("morjarin", "blue", "nirmal@hotmail.com", "nirmal", "morjaria"); # # Table structure for table 'artistlibrary' # CREATE TABLE artistlibrary ( library_id bigint(100) unsigned NOT NULL default '0', track_id bigint(100) unsigned NOT NULL default '0', username varchar(100) NOT NULL default '', PRIMARY KEY (library_id) ) TYPE=MyISAM; # # Dumping data for table 'artistlibrary' # # # Table structure for table 'artists' # CREATE TABLE artists ( username varchar(50) NOT NULL default '0', password varchar(50) default NULL, forename varchar(50) default NULL, surname varchar(50) default NULL, email varchar(50) default NULL, website varchar(100) default NULL, PRIMARY KEY (username) ) TYPE=MyISAM COMMENT='Holds details about the artists '; # # Dumping data for table 'artists' # INSERT INTO artists VALUES("morjaria", "blues", "nirmals", "morjarias", "nirma@hotmail.coms", "www.google.co.uks"); # # Table structure for table 'members' # CREATE TABLE members ( username varchar(50) NOT NULL default '0', forename varchar(50) default NULL, surname varchar(50) default NULL, email varchar(50) default NULL, password varchar(20) default NULL, PRIMARY KEY (username) ) TYPE=MyISAM; # # Dumping data for table 'members' # INSERT INTO members VALUES("nirmal", "nirmals", "morjaria", "nirm@yahoo.co.uk", "blue"); # # Table structure for table 'memlibrary' # CREATE TABLE memlibrary ( libray_id bigint(100) NOT NULL auto_increment, track_id bigint(100) unsigned NOT NULL default '0', username varchar(100) NOT NULL default '', PRIMARY KEY (libray_id) ) TYPE=MyISAM COMMENT='Member library records'; # # Dumping data for table 'memlibrary' # # # Table structure for table 'tracks' # CREATE TABLE tracks ( track_id mediumint(3) unsigned NOT NULL auto_increment, trackname varchar(200) default NULL, description longblob, genre varchar(20) default NULL, duration varchar(50) default NULL, artist varchar(50) default NULL, filename varchar(100) default NULL, picture varchar(100) default NULL, PRIMARY KEY (track_id) ) TYPE=MyISAM COMMENT='Holds the details of current MP3 in the systems.'; # # Dumping data for table 'tracks' #
  3. $query="SELECT tracks.track_id, tracks.trackname, tracks.description tracks.genre, tracks.duration, tracks.artist, tracks.filename, tracks.picture FROM tracks LEFT JOIN artistlibrary ON tracks.track_id = artistlibrary.track_id AND artistlibrary.username <> '$username' WHERE artistlibrary.track_id is null"; I revised the query yet again but with no luck ok here are the exact table layouts ************************************************************************* artist ibrary library_id auto increment track_id foreign key primary key in tracks table username username of the user ************************************************************************** tracks track_id primary key trackname description genre duration artist filename picture ************************************************************************************* Yeah i was trying to extract all the rows in the tracks table which didnt have the same track_id as rows within the artlist library table where artistlibrary.username = provided username. thanks for your help in advance
  4. Hi there guys I need some major super duper help Basically heres what i was trying to do I have a table which holds the details of tracks(music tracks) with the database. I have another table called artistlibrary. The artist library table has unique ID(AUTOINCREMENT), track_id(foreign key to the tracks table), username. Basically what i was trying to do is extract all of the records in the tracks table whose track_id was NOT EQUAL to the artistlibrary.track_id and also artistlibray.username NOT equal to the current username (ie $username captured session variable) Here are the two queries i have tried but cannot get to work //$query="SELECT tracks.track_id, tracks.trackname, tracks.description //tracks.genre, tracks.duration, tracks.artist, tracks.filename, //tracks.picture //FROM tracks //LEFT JOIN artistlibrary //ON tracks.track_id = artistlibrary.track_id //AND artistlibrary.username/= '$username' //WHERE //artistlibrary.track_id is null"; $query="SELECT tracks.track_id, tracks.trackname, tracks.description tracks.genre, tracks.duration, tracks.artist, tracks.filename, tracks.picture,artistlibrary.username, tracks.track_id FROM tracks, artistlibrary where artistlibrary.username /= '$username' && tracks.track_id /= artistlibrary.track_id"; So basically i was trying to obtain the row from tracks table which didnt have the same track_ID as one in the artist libray table with the artist_library.username captured through a session variable at login! If someone could help I would be very greatful! n
  5. [!--quoteo(post=379185:date=Jun 1 2006, 04:24 PM:name=cody7)--][div class=\'quotetop\']QUOTE(cody7 @ Jun 1 2006, 04:24 PM) [snapback]379185[/snapback][/div][div class=\'quotemain\'][!--quotec--] please check getimagesize() function to retrieve image size.. hope this helps. [/quote] Codey i have identified that function as problematic, i dont know if you looked at the txt file? <?php #################################################################################### include('../includes/general.php'); include('../includes/print_date.php'); include('../includes/db_connect.php'); ##################################################################################### ##Script that allows the administrator to delete and download tracks $query = "select * from tracks"; $result =mysql_query($query); $num_rows=mysql_num_rows($result); ##YES WE HAVE RECORDS IF ($num_rows > 0) { echo "<center><h2>Delete or download existing tracks</h2></center>"; echo "<br><br>"; #################################################################################### ##DIRECTORIES REQUIRED FOR THE DISPLAYING OF FILES $music="music/"; $pics="pics/"; $music_directory=$directory.$music; $pic_directory=$directory.$pics; //$newdir="../files/"; #################################################################################### //LETS PRINT THE TABLE echo "<br><hr><center><b>Tracks available for deletion or download</b></center><br>"; echo "<center>"; echo "<TABLE BORDER='4' BORDERCOLOR='#990000' CELLPADDING='2' CELLSPACING='2' WIDTH='49%'>"; echo "<TR>"; echo "<TD>Picture!</TD><TD>Track-Name</TD><TD>Description</TD><TD>Genre</TD> <TD>Artist</TD><TD>Duration</TD><TD>Filesize</TD><TD>Operations</TD> "; echo "</TR>"; //Lets loop through the database getting the information we need! //$result was collected at the start of the code $opendir1 =opendir($pic_directory); $opendir2 =opendir($music_directory); while ($row = mysql_fetch_array($result)) { $track_id=$row['track_id']; $trackname=$row['trackname']; $description=$row['description']; $genre=$row['genre'];; $artist=$row['artist']; $duration=$row['duration']; $filename=$row['filename']; $picture=$row['picture']; // since i am using gallery we have to get the width and hieght of photos. ///$picture2="3.jpg"; $imgsize = getimagesize($pic_directory.$picture); /////////HERES THE PROBLEM //$imgsize = getimagesize($upload."/".$filename); // lets get the file size in byte/kb/mb. $file_size = filesize($music_directory.$filename); if ($file_size >= 1048576){ $show_filesize = number_format(($file_size / 1048576),2) . " MB"; }elseif ($file_size >= 1024){ $show_filesize = number_format(($file_size / 1024),2) . " KB"; }elseif ($file_size >= 0){ $show_filesize = $file_size . " bytes"; }else{ $show_filesize = "0 bytes"; } if ($imgsize[0] > 100){ $base_img = "<img src=\"$pic_directory$picture\" border=\"0\" width=\"100\">"; }else{ $base_img = "<img src=\"$pic_directory$picture\" border=\"0\">"; } //lets print each row echo "<TR>"; echo "<TD> <a href=\"javascript:popimg('$pic_directory$picture','$picture', $imgsize[0], $imgsize[1],'white')\"> $base_img</a> </TD> <TD><center>$trackname</center></TD> <TD><center>$description</center></TD> <TD><center>$genre</center></TD> <TD><center>$duration</center></TD>"; //Lets get the artist name in a comparable analogous manner ############################################################################################# $artistname = "select forename, surname from artists where username = '$artist'"; $resulter = mysql_query($artistname); while ($row = mysql_fetch_array($resulter)) { $FORENAME=$row['forename']; $SURNAME=$row['surname']; echo "<TD><center>$FORENAME\n$SURNAME</center></TD>"; } ############################################################################################# //LETS PRINT THE FILESIZE echo "<TD><center>$show_filesize</center></TD>"; //LETS PROVIDE NICE DELETE AND DOWNLOAD LINKS echo "<TD><center> [[<A HREF=\"$music_directory$filename\">Download</A> ]] [[<A HREF=\"per_delete.php?row_ID=$track_id\">Delete</A>]] </center></TD>"; } echo "</TR>"; echo "</center></table>"; closedir($opendir1); closedir($opendir2); clearstatcache(); } ELSE { echo "<center>"; ECHO "<H2><B>No Tracks Have Been Added Yet!</B><H2>"; echo "</center>"; echo "<CENTER><a href='track_form.php' class='displayText'>Add</font></a><br></CENTER>"; echo "<CENTER><a href='index.php' class='displayText'>Home</font></a><br></CENTER>"; } ?> MESSAGE ! Ok the script above creates a kind of gallery page, the problem im having is that the getimagesizefunction is not working and is refusing to open my file $imgsize = getimagesize($pic_directory.$picture); /////////HERES THE PROBLEM $file_size = filesize($music_directory.$filename); The path has to be correct because the filesize is working fine and its path is virtually the same , just a different folder $music="music/"; $pics="pics/"; $music_directory=$directory.$music; $pic_directory=$directory.$pics; Whats happening is because i cant retrieve the image size it blows the javascript pop up function out because it requires them parameters to work ie height and width of the image. at the moment as it is it just shows one hugh image , another funny thing is when i changed the name of the variable $picture in the fetch array loop it just failed to show anything somebody please help sort this out ! Im just completely out of solutions thanks for your time n
  6. [!--quoteo(post=379175:date=Jun 1 2006, 03:58 PM:name=norman100)--][div class=\'quotetop\']QUOTE(norman100 @ Jun 1 2006, 03:58 PM) [snapback]379175[/snapback][/div][div class=\'quotemain\'][!--quotec--] [a href=\"http://69.9.45.42/~nirmal/MESSAGE.txt\" target=\"_blank\"]http://69.9.45.42/~nirmal/MESSAGE.txt[/a] Hi guys sorry about the above it wouldnt let me post the entire message, see the above text file dont load it in ur browsers because it doesnt open as a text file but in some different way ! please take alook guys [/quote] IF YOU RIGHT CLICK AND SAVE THE FILE IT SHOULD BE COOL RATHER THEN CLICKING THROUGH THE LINK!
  7. [!--quoteo(post=379168:date=Jun 1 2006, 03:38 PM:name=norman100)--][div class=\'quotetop\']QUOTE(norman100 @ Jun 1 2006, 03:38 PM) [snapback]379168[/snapback][/div][div class=\'quotemain\'][!--quotec--] Whats happening is because i cant retrieve the image size it blows the javascript pop up function out because it requires them parameters to work ie height and width of the image. at the moment as it is it just shows one hugh image , another funny thing is when i changed the name of the variable $picture in the fetch array loop it just failed to show anything somebody please help sort this out ! Im just completely out of solutions thanks for your time n [/quote] [a href=\"http://69.9.45.42/~nirmal/MESSAGE.txt\" target=\"_blank\"]http://69.9.45.42/~nirmal/MESSAGE.txt[/a] Hi guys sorry about the above it wouldnt let me post the entire message, see the above text file dont load it in ur browsers because it doesnt open as a text file but in some different way ! please take alook guys
  8. Whats happening is because i cant retrieve the image size it blows the javascript pop up function out because it requires them parameters to work ie height and width of the image. at the moment as it is it just shows one hugh image , another funny thing is when i changed the name of the variable $picture in the fetch array loop it just failed to show anything somebody please help sort this out ! Im just completely out of solutions thanks for your time n
  9. [!--quoteo(post=360661:date=Apr 1 2006, 01:41 PM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Apr 1 2006, 01:41 PM) [snapback]360661[/snapback][/div][div class=\'quotemain\'][!--quotec--] I've set a simple sample system similar to yours. Hope it helps The table [code]CREATE TABLE property (         propID int not null auto_increment primary key,         descrip varchar(20),         price int,         sold varchar(3)         );[/code] The data [code]INSERT INTO property (descrip, price) VALUES ('a house', 220000), ('big house', 354995), ('huge house', 1295000), ('bungalow', 295000), ('studio apartment', 140000);[/code] The code [code]<?php include 'db.php'; // -- supporting functions ------------------------------------------------------------------ function listProperties() {          $sql = "SELECT propID, descrip, price, sold                  FROM property                  ORDER BY price ";          $res = mysql_query($sql) or die (mysql_error());          echo "<TABLE width='500' cellspacing='0' cellpadding='5'>\n";          echo   "<TR>                   <TH>ID</TH>                   <TH>Property</TH>                   <TH>Price</TH>                   <TH>Sold</TH>                   </TR>\n";          while (list($id, $desc, $price, $sold) = mysql_fetch_row($res)) {                 $btnval = ($sold=='Yes') ? 'Yes' : 'No';                 $script = $_SERVER['PHP_SELF'];                 $btn = "<INPUT type='button' value='$btnval' onClick='location.href=\"$script?sellid=$id\"'>";                 echo   "<TR>                   <TD>$id</TD>                   <TD>$desc</TD>                   <TD style='text-align:right'>" . number_format($price,0) . "</TD>                   <TD style='text-align:center'>$btn</TD>                   </TR>\n";          }          echo "</TABLE>\n"; } function sellProperty($id) {          $sql = "SELECT sold FROM property                  WHERE propID = '$id'";          $res = mysql_query($sql) or die (mysql_error());          $sold = mysql_result($res, 0);          $sellval = ($sold=='Yes' ? 'No' : 'Yes');          mysql_query ("UPDATE property SET sold = '$sellval' WHERE propID = '$id'"); } // --  end functions ------------------------------------------------------------------ if (isset($_GET['sellid'])) {     sellProperty($_GET['sellid']); } ?> <HTML> <HEAD> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> <meta Name="generator" content="PHPEd Version 3.1.2 (Build 3165)"> <title>Sample property page</title> <meta Name="author" content="Barand"> </HEAD> <BODY> <?php      listProperties(); ?> </BODY> </HTML>[/code] [/quote] Michelle did you not use that function which i gave you in the end All you had to do was include the file and call the function where ever you wonted to place the button, buttom($id); that is it, u could have placed this in a table cell too if you wonted to print everything it would be something like this $queries ="select * from properties"; $result = mysql_query($queries); While ($row=mysql_fetch_array($result)) { $id=$row['id]; ##PRINT THE TABLE AND CONTENTS <TD style='text-align:center'>buttom($id);</TD> } AND THATS IT! U MIGHT GET A PARSE ERROR OR 2 BECAUSE I HAVENT RAN AND TESTED ANYTHING, I HAVE THE FUNCTION OF COURSE!!
  10. [!--quoteo(post=359568:date=Mar 29 2006, 02:15 AM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 29 2006, 02:15 AM) [snapback]359568[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code]if (is_dir('users/'.$username)) {   mkdir('users/'.$username);   chmod('users/'.$username, 0755); }[/code] [/quote] Hi there if (! is_dir($directory_path.$Code.'/'.$username)) { mkdir($directory_path.$Code.'/'.$username); } //NOTE : ! before the is_dir function, if it does not exist lets create it! //you can omit the following two lines and have newname hold the name of ur file. //also the directory paths will need ammending $ext=substr($_FILES['coursework']['name'], -4); $newname=$Username.$ext; $result = move_uploaded_file($_FILES['coursework']['tmp_name'], $directory_path.$Code.'/'.$username.'/'.$newname) ;
  11. [!--quoteo(post=359479:date=Mar 28 2006, 07:09 PM:name=shortj75)--][div class=\'quotetop\']QUOTE(shortj75 @ Mar 28 2006, 07:09 PM) [snapback]359479[/snapback][/div][div class=\'quotemain\'][!--quotec--] this is the code i user i dont know if it will work if your not running your own server [code] mkdir("C:/path/to/directory/$username") or die("Sorry I could not make the directory you requested<BR>"); [/code] and heres the code to delete the directory so you will have it just in case [code] rmdir("C:/path/to/directory/$username") or die("Sorry I could not delete the directory you requested<BR>"); [/code] you can try it wit a web address but if you dont run your own server you may not have the correct permissions to create directories good luck [/quote] I will come back and answer this for you tommorrow it can be done!!!
  12. Thats actually a common misconception, mysql_query will return true if the query ran, it will also return true if the query ran but didnt return any results. The feature which u require is mysql_num_rows, this returns the amount of rows as an integer that a query returns.
  13. Hi In the first instance try the following <button onclick="window.location='sold.php?id=<? echo $row_p['id']; ?>'"> <? IF (!$status) { $status = 'No' echo $status; } ELSE { //WE HAVE A VALUE $status=$row_p['sold']; echo $status; } ?></button> Ober no you misunderstood me, I just wanted to discuss the problem in more detail perhaps even see the underlying mysql database, I felt that i couldnt get this same level of communication through the forum, But should that be your wish that it all stays online then thats fine.
  14. Michelle! Thats not even a problem add me to msn nokia_buyer@hotmail.com or email me and we will discuss this nirmal [!--quoteo(post=359313:date=Mar 28 2006, 10:34 AM:name=michellephp)--][div class=\'quotetop\']QUOTE(michellephp @ Mar 28 2006, 10:34 AM) [snapback]359313[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi everyone, thanks for your replies! I tried both options but sadly neither worked. The first made the button say 'no', but when clicked did not then say 'yes', nor was the db updated. The second gave me this error: Parse error: syntax error, unexpected T_ELSE I think (but really have no idea) that the problem may be that the propety hasn't got a sold status, until the button is clicked. Then if it is clicked once, the staus is then 'no'. Clicked again and the status is 'yes'. Clicked again, back to 'no', etc etc. My main problem with it is that it looks a bit dodgy having a button with no writing in it. Maybe, if I had raido buttons, one for yes, and one for no, it would look passable. But I've no idea how to make the script adapt to that. Or maybe just a single little radio button they could click once it has sold. So that would mean the property never has the status 'no' (ie not sold) just 'yes'. Unless the button is unclicked... then the status would be no. But that's pretty much the same as what I've got............ although I think the empty radio button would look better than the empty button. I'll try to make it into a radio button instead :) If anyone knows how to do it off the top of their head please feel free to show me :) :) Otherwise I'll play around till I get it. Thanks! [/quote]
  15. <button onclick="window.location='sold.php?id=<? echo $row_p['id']; ?>'"><? echo $row_p['sold']; ?></button> Michelle, i think that you will need a IF statement in here , <button onclick="window.location='sold.php?id=<? echo $row_p['id']; ?>'"> <? $status = $row_p['sold']; IF (!$status) { $status = 'No' ELSE //WE HAVE A VALUE $status=$row_p['sold']; } ?></button> [!--quoteo(post=359255:date=Mar 28 2006, 08:17 AM:name=michellephp)--][div class=\'quotetop\']QUOTE(michellephp @ Mar 28 2006, 08:17 AM) [snapback]359255[/snapback][/div][div class=\'quotemain\'][!--quotec--] Thanks for the suggestion :) but it didn't seem to fix it. Now, the button automatically displays 'yes' (i want 'no') and when click it still says yes and doesn't update the db. i'm totally stumped! [/quote]
×
×
  • 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.