Jump to content

Deno

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by Deno

  1. Nevermind...I got it to read the text file now after doing some reading and research. But I have one question though... Say that on the text file, I have a list of words on there, so on my web browser, how do I get it to print one word from the text file, then next line, then the next word and so on and so on? cause right now, it's printing all the words on one line. Any help would be appreciated, thanks again everyone!
  2. Hey! thanks for replying everyone! You're right, I forgot to create the folder. Now that I did, I opened the page again on my web browser and now I get a blank page? What's happening now?
  3. Hi, I just starting learning about php reading text files, and I wrote a script, and then tested it on my server and I get this error message: Warning: fopen(notes/data/names.txt) [function.fopen]: failed to create stream: No such file or directory in c:\inetpub\wwwroot\testwritepage.php on line 10 Couldn't open the data file. Try again later. Here's my script: <?php $fp = fopen( "notes/data/names.txt", "w" ); if(!$fp) { echo "Couldn't open the data file. Try again later."; exit; } ?> I don't understand why I'm getting errors already for such a simple lines of code that I copied and pasted from a tutorial site. Any help would be appreciated as always. Thanks.
  4. Hello, I have another problem now: This is relating back to my interviews.php page. When I try to select a link, it won't print the page contents. In my database "interviews", I have the following fields: interview_id, name and page. Page contains the filename of the page, that page mainly has one image and a bunch of text. Is there a way PHP can print php files? Any help would be appreciated, thanks.
  5. Hey guys, I found my error and I got the script working! Thanks guys, appreciate it a lot! ;-)
  6. Hi Raul, Here's the code for my page interviews.php. The red highlight indicates that that is line 38. By the way, this page is part of include of page.php?select=. You see page.php is like the template of the site, when the user selects a link, it takes a link then it includes whatever page they clicked on, so in this case it's page.php?select=interviews.php. So on page.php?select=interviews.php, there's the one piece of code there that says include("$select");, where in this case, it's include("interviews.php"). Just to let you all know that. See what you can make of it. Uber-Thanks. :-) <?php $Host = "localhost"; $User = "starryc_Deno"; $Password = "****"; $DBName = "starryc_db1starryc"; $TableName = "$select"; $Link = mysql_connect($Host,$User,$Password) or die("Error connectiong to the database: ".mysql_error()); //connect to the database mysql_select_db($DBName], $Link) or die ("Unable to select database: ".mysql_error()); // Select the desired database $Query = "select * from $TableName"; $Result = mysql_query($Query,$Link) or die("Error when querying the database: ".mysql_error()); if(mysql_num_rows($Result) == 0) { print("No results to display."); print("$select"); } while ($Row = mysql_fetch_array($Result)) { /*//print("<b><a href="newsdetail.php?detailno=$Row[newsID]'">$Row[headline]</a></b><p>");*/ print("$Row[name]<p><br></p>"); } mysql_close($Link); //close the connection ?>
  7. Hey everyone, Deno again. Apologies for the late reply, I've been uber-busy lately. I just copied and pasted the code you sent me Raul, and now I get a parse error on line 38. Any ideas?
  8. Thanks for replying and for your help everybody, I appreciate it a lot. I did notice the } error as mentioned and changed it, but I'm still getting the error. The link to my client's site is http://www.starryconstellation.com. Click on the "Interviews" button, and you'll find my error there. What I actually want it to do, is when you click on that button, it'll go and retrieve a list of interviews from the MySQL DB, but now you'll find those errors I've mentioned. Please let me know what you think of this situation. Thanks again. Deno
  9. I sent a ticket to help desk, but they tell me to go to the forum cause the tech support don't deal with scripting code. They did however give me this code: $dbh=mysql_connect ("localhost", "starryc_Deno", "PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("starryc_db1starryc"); They were telling me that I didn't create the user in the DB. When I now run the script, I STILL get the same error, it's saying that functions such as mysql_db_query, mysql_num_rows, mysql_fetch_array and mysql_close are not valid functions. Could someone please help me out? what am I doing wrong? Any help would be appreciated. Thanks.
  10. Hey thanks for replying Raul! And yes, I have sent you a ticket already.
  11. Hi everyone, I'm Deno, and I'm new to this forum. I just purchased web hosting from totalchoicehosting last week, and I like it so far. Anywho, I'm having some trouble with my php scripting, and I'm wondering if anybody can help me out, I'd really appreciate it: I have a MySQL DB setup already, and when I want to do a simple data retrieval, say a user clicks on a link and retrieves that specific data on that specific link. However, when I uploaded my page to the webserver, I get an error that MySQL functions such as mysql_fetch_array and mysql_num_rows are INVALID functions. Why is this? Could someone explain to me how to get it running and what I'm doing wrong here. Again, any help would be totally appreciated. Here's my code: $Host = "localhost"; $User = "USERNAME $Password = "PASSWORD"; $DBName = "DBNAME"; $TableName = "$select"; $Link = mysql_connect($Host,$User,$Password); //connect to the database $Query = "select * from $TableName"; $Result = mysql_db_query($DBName,$Query,$Link); if(mysql_num_rows($Result) == 0) { print("No results to display."); print("$select"); } //checks to see if there's any data to display while ($Row = mysql_fetch_array($Result)) { //print("<b><a href='newsdetail.php?detailno=$Row[newsID]'>$Row[headline]</a></b><p>"); print("$Row[name]<p><br></p>"); //} mysql_close($Link); //close the connection
×
×
  • Create New...