
rubyarat2010
Members-
Posts
40 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
rubyarat2010's Achievements

Newbie (1/5)
0
Reputation
-
Thank you so much!
-
It is a little "program" I am making to help me with somthign else. I know it is not that safe of a method but only I will be using it. I tried what you put but it kind of gives me the same error you said ( ! ) Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$' in C:\wamp\www\NotesWebsite\ViewNote.php on line 4 Thank you for the quick reply!
-
This code is meant to retrieve a row in a form but it returns nothing, I have tried it many different times even with HTML in it it returns nothing at all. <?php $conn = new mysqli("****", "***", "****"); $conn->select_db('mynotesdatabase'); $result = mysqli_query($conn, "SELECT * FROM" . $_GET['Folder'] . "WHERE Name='" . $_GET['Name'] . "'") or die(mysql_error()); while($row = mysqli_fetch_array($result) or die(mysql_error())) { echo "<br>"; echo $row['Main']; echo "<br>"; } echo "<br/> <a href='javascript:history.back(-1);'>Back</a>"; ?>
-
Printing out MySQL table names with PHP
rubyarat2010 replied to rubyarat2010's topic in PHP Coding Help
Thank you so much man! Yea I was mxixing em up >.< -
Printing out MySQL table names with PHP
rubyarat2010 replied to rubyarat2010's topic in PHP Coding Help
Also I realized that the variable database is not database but tables. Just an FYI. Here is the full code if you want to see it, sorry to double post $con=mysql_connect("*", "*", "*", "mynotesdatabase") or die(mysql_error()); $query = mysql_query("SHOW TABLES FROM mynotesdatabase") or die(mysql_error()); while($row = mysql_fetch_array($query)) { $table = $query; $result = mysql_query("SELECT * FROM $table", $con) or die(mysql_error()); echo "<b>+" . $table . "</b><br/>"; while($row = mysql_fetch_array(mysql_query($result, $con))) { $type = ""; if($row['Type'] == 0){ $type = "Link"; } else{ $type="Note"; } echo "  -" . $row['Name'] . " (" . $type . ")"; echo "<br>"; } } mysql_close($con); -
Printing out MySQL table names with PHP
rubyarat2010 replied to rubyarat2010's topic in PHP Coding Help
Hey man thank you so much! I did not see those, so I changed them all to mysql. Now I have this but all it says is "No database selected": $query = mysql_query("SHOW TABLES FROM mynotesdatabase") or die(mysql_error()); while($row = mysql_fetch_array($query)) { $database = $query; $result = mysql_query("SELECT * FROM $database", $con) or die(mysql_error()); echo "<b>+" . $database . "</b><br/>"; while($row = mysql_fetch_array(mysql_query($result, $con))) { $type = ""; if($row['Type'] == 0){ $type = "Link"; } else{ $type="Note"; } echo "  -" . $row['Name'] . " (" . $type . ")"; echo "<br>"; } } mysql_close($con); -
So I want to get each table name in a MYSQL database and put it in the variable database. This is what I have so far but I cant seam to get it working, thanks in advance! It just says "Access denied for user ''@'localhost' to database 'mynotesdatabase'" But when I print out the actual rows of the tables it works but not when I want to print out the table names. if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else{ echo "Connected", "<br/>"; } $query = mysql_query("SHOW TABLES FROM mynotesdatabase") or die(mysql_error()); while($row = mysql_fetch_array($query)) { $database = $query; $result = mysqli_query($con,"SELECT * FROM $database"); echo "<b>+" . $database . "</b><br/>"; while($row = mysqli_fetch_array($result)) { $type = ""; if($row['Type'] == 0){ $type = "Link"; } else{ $type="Note"; } echo "  -" . $row['Name'] . " (" . $type . ")"; echo "<br>"; } } mysqli_close($con);
-
Ok i got it one other thing i assighn the header at the end but it gives me this error Warning: Cannot modify header information - headers already sent by (output started at /home/zendavis/public_html/insert.php:2) in /home/zendavis/public_html/insert.php on line 76?
-
I did even tried puting periods like he showed Author:'$author; '<br/> Date: '$date;' <br/> ' $body;'
-
Still Gives me erorrs:(((((( <?php $author=$_POST["author"]; $date=$_POST["date"]; $title=$_POST["title"]; $body=$_POST["body"]; $imagelink=$_POST["imgl"]; $link = $title ; $con = mysql_connect("localhost","zendavis_tim","sherlock11<>"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("zendavis_posts", $con); mysql_query("INSERT INTO posts1 (author, imagelink,date,body,title,link) VALUES ('$author', '$imagelink','$date','$body','$title','$link')"); $title = str_replace(" ", "_", $title); $conatent = ' <!doctype html> <html> <head> <title>Zen Davis.com</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="style.css" type="text/css" rel="stylesheet" /> </head> <body link="#5e6959" h3="#5e6959" vlink="#5e6959" > <div class="content"> <div class="top_block NavMenu"> <div class="content"> <!--Navigation line --> <h1><div style="text-align:center"><p><a href="Index.php" style="text-decoration: none" >Home</a>  <a href="About.html" style="text-decoration: none" >About</a>   <a href="Contact.php" style="text-decoration: none" >Contact</a>   <a href="Games.php" style="text-decoration: none" size="25">Games</a></p></div></h1> </div> </div> <div class="top_block MiddlePhoto"> <div class="content"> Author:'$author; '<br/> Date: '$date;' <br/> ' $body;' </div> </div> <div class="top_block BottomTables"> <div class="content"> </div> </div> </div> <!-- * Layout generated with http://layzilla.com * Layout generator is free of use. * We appreciate if you leave this comment block in commercial use of generator. * All comment and ideas can be submitted to us using contacts below. * * site: www.jmholding.com * email: [email protected] * twitter: @jmholding --> </body> </html> '; $file = "$title.html"; $open = fopen($file, "w"); fwrite($open, $conatent); fclose($open); header("Location: http://zendavis.com/$link.html"); ?>
-
<?php echo $author ?> this didint work either.
-
sorry but this didint work Author: "$author" <br/> Date: " $date" <br/> "$body"
-
mikosiko works now but now the php variables in the html dont work?
-
mikosiko works now but now the php variables in the html dont work?
-
but thats not in the html?