Jump to content

Miklo

New Members
  • Posts

    6
  • Joined

Everything posted by Miklo

  1. Ok so I am back after trying the methods used by @pryankagound code and @Silverback3: @pryankagound, The method was good but I cant use it as long as jquery is involved. But thanks a lot for your time adding the code. I would be appreciated if you could use the "Code" tags for next time because it was hard for me to figure out which part belonged to who.. lol @SilverBack3, I loved your method, but since I am very new I did not understand why some of the $variables were added without any code attached to it. For example on the lines: if($db_found){ >> Where is the $db_found part, and how to add it? $result = mysql_query($SQL, $db_handle); >> What is the $dbhandle for? Thats all and so far I couldnt make it work.. I appreciated all your help guys, And hope that I could get the last part done.. I think Silverback came witht he best option.
  2. Thank you so much guys! I just came online after some time so I apologise for late reply! I will be trying the methods added above, and I will be back to leave if it worked for me! I really appereciate each and every answer from the bottom of my heart! I really knew you guys were great on here! God bless, Will be back
  3. Updates: (Still not done) I got some help by a friend and realised I was doing it all wrong, For example my friend is using the LIKE method and so far I only see the ID's when the script loads, I will ofcourse fix it later but I cant make the the SEARCH FIELD work. I tried to add a button and used a form with POST and GET! Here is Screenshot: And this is the Code: <input type="text" name="address"> <input type="hidden" name="username" value="username"/> <select name="email"> <option selected="selected"> </option> <?php include("sqldb.php"); $conn = mysql_connect($dbhost,$dbuser,$dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); $order = "SELECT * FROM users ORDER BY id" or die (mysql_error()); $result = mysql_query($order); while($data = mysql_fetch_array($result)) { echo ("<option> $data[username] </option>"); } if(isset($_POST['email'])) { $username = $_POST['username']; $email = $_POST['email']; $query = "SELECT * FROM users WHERE $username LIKE '%".$email."%'"; echo "<tr><td colspan='8'>$num_rows Results Found</td></tr>"; while($data = mysql_fetch_array($result)) { echo("<tr> <td>$data[username]</td> <td>$data[email]</td> </tr>"); } } ?> This has been helpfull for me and I have made many changes to it. And I need help to simply add a button without ruining it, because I am really not good in php! Thank you in advance
  4. Hello everyone! I am setting up a simple "Textarea" like a search-field for my forum users. So our users can get their info and info directly and change it if they wanted to. So by typing their usernames in the "textarea" they users should get ther Username and Email. Right now I am using a single Table with 3 columns called "ID", "USERNAME", "EMAIL"! I have tried a few methods but I simply cannot make it work! If I can get the info by typing the ID only, thats also fine.. But then our users cannot see their ID's usually so I really need some professional help to make the Textarea work as a search fieldm, and I wish some one could provide me a simple code. Right now I am working on this code and after some time I gave up! <?php include("sqldb.php"); if (isset($_GET['username'])) { $id = (int) $_GET['username']; } $conn = mysql_connect($dbhost,$dbuser,$dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); $result = mysql_query("SELECT * FROM users WHERE username = '".$_GET['username']."'") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { echo '<th>Username</th><td>'; echo $row['username']; echo '</td></tr>'; echo '<tr><th>Email</th><td>'; echo $row['email']; echo '</td></tr>'; echo '</tbody></table>'; echo '</td></tr>'; } ?> <form action="" class="form" method="GET"> <textarea id="id" name="id" rows="5" style="width: 200px;"><?php $_GET['username']; ?></textarea> <input type="submit" name="submit" id="submit" value="Send"> </body> </html> I tried to use the POST and GET method in my html, but that didnt work either! I have tried arround 10 different jquery methods which didnt help either! Thank you very much in advance...
  5. I still havnt got any Answer on a forum that I really counted on would at least answer back if not the fix.. Anyways, I came to let you guys know that I finally managed to fix it. By myself! Topic is Solved and can be closed
  6. Hey Everyone! I am Miguel, you can also call me Miklo! I joined here because I simply couldnt find a php forum with some myql support! I finally managed to find this forum! I am glad to be a part of the community, and I am a web developer with very poor web developing knowledge lol! Just being honest! Thanks for having me . Ps, Here is my first topic asking for some help >> http://forums.phpfreaks.com/topic/281079-how-to-create-a-simple-mysql-table-using-php-or-html-textarea/ God bless
  7. First of all, I am Miguel and very happy to have found this forum! I really been looking for a nice php forum with mysql experts as well! And I really need your help today! My Question is simple: How to create a simple Table with a PHP file from a Textarea! Here is an example Image of how I want the Textarea to look like: I found a Code online a few days ago, that Allows users to Trace their Visitors. The Script was an IP Logger that I later changed to a "Visitor Tracker".. So users will be able to pick a URL or a FOLDER by simply typing the name of the folder in the Textarea! After clicking Submit the text will be changed to a Folder and then used as a URL! And that URL will be their Tracking Folder- So if the user creates a username called "mike", then the folder will be "www.website.com/mike. Now here is the problem! The script I have have 1 TABLE, and rest of the other tables are inside that one table!Then everyone website owener will be able to see eachothers visitors. Not good. Thats why I wanted to Create a PHP file that simply Creates a NEW TABLE for each user. And thats where I am locked. This is the code I am using for my index.php page: <form action="" method="post" > <table width="400" border="0" cellspacing="0" cellpadding="5"> <tr> <td colspan="3" align="center">Please write gallery name and description</td> </tr> <tr> <td>Name </td> <td> </td> <td><input type="text" name="gname" id="text" value=""></td> </tr> <tr> <td colspan="3" align="center"><input type="submit" name="submit" id="submit" value="Submit"></td> </tr> </table> </form> <?PHP if (isset($_POST['submit'])) { $name = $_POST['gname']; $username = 'gname'; echo " "; echo "Conguradulations. Your new URL is sucessfully created.!"; echo " "; echo " "; echo "Your new URL name is www.Removed.com/$name"; } $dbhost = 'host'; $dbuser = 'username'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; $sql = 'CREATE TABLE test('. 'entry_id int(11) NOT NULL AUTO_INCREMENT, '. 'visitor_id int(11) default NULL, '. 'ip_address varchar(15) NOT NULL, '. 'page_name text, '. 'query_string text, '. 'timestamp timestamp NOT NULL default CURRENT_TIMESTAMP, '. 'PRIMARY KEY ( entry_id ), '. 'KEY visitor_id ( visitor_id , timestamp )) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=22 ;'; mysql_select_db('testdb'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not create table: ' . mysql_error()); } mysql_query($sql,$conn); ?> I tried to change this: CREATE TABLE test to CREATE TABLE $name But still didnt work! I am really new using this kinda scripts. So I am kinda lost..After 4 days of searching, I found a script in here so I thought I could maybe get some help in here.. As you can see the SQL creates a table with the name "test" and adds all the other tables inside! And thats what I want to change so the Textarea text could replace the test for each new user, and when the table is created, it should then rest of the querries should be added in there... I found a the Script in here, dont know if this could help >> http://forums.phpfreaks.com/topic/168449-solved-inserting-multiple-lines-from-a-text-area-to-sql-table/ Here is another Script too, but in another forum: http://www.webmasterforums.com/php-development/3343-textarea-mysql.html I tried for days on the last script, but I couldnt make that work either! I dont know which page should be added where, and How I should add my SQL code inside... so if anyone could fix the problem with more professional knowledge, then my days and weeks of hard work is saved! Thank you very very much in advance!
×
×
  • 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.