Jump to content

OsirisElKeleni

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by OsirisElKeleni

  1. Thank you all for you're replies! I have been stupid and forgot thet HTML doen't belong in the php tags.. And indeed the else function is nothing without an if
  2. I dont see where I'm missing the closing tag i'm sorry, The php.ini file i've uploaded and this is the error: Parse error: syntax error, unexpected '$row' (T_VARIABLE), expecting ',' or ';' in /home/osiris1q/public_html/includes/header.php on line 20 This is the line but i dont see whats wrong: echo "<li><a href='#'></a>"$row"</li>";
  3. Hello again! I'm here with another PHP/Mysqli related question, I want to output the data i receive from the Query: SHOW tables; Into html code, more specific: links. This is what i try'd to do: <div class="container"> <div class="header" align="center"> <nav> <ul> <li><a href="#">Home</a></li> <li><a href="#">Databases</a> <ul> <?php $mysqli = new mysqli('localhost','*****','*****','*****'); if ($mysqli->connect_error) { die("Connection failed: " . $mysqli->connect_error); } $sql = 'show tables from osiris1q_mtg'; $result = $mysqli->query($sql); if(!$result = $mysqli->query($sql)){ die('There was an error running the query [' . $mysqli->error . ']'); } // output data of each row while($row = $result->fetch_assoc()){ echo "<li><a href='#'></a>"$row"</li>"; } } else { echo "<li><a href='#'></a>0 results</li>"; } </ul> </li> </ul> </nav> </div> <!-- end .header --> ?> This is the header.php file which is included in the actual index page. This doesn't return anything not even the html parts of it. Even all the files i have 'included' aren't showing up anymore. I hope i explained myself good enough for anyone to understand How Anyone can help me out! Thank you in Advance!
  4. Okido! I will try it and get back to you with results or errors i can't solve thanks a lot!
  5. alright i just thought that if i would get the data and close the connection the data would be lost. Thanks for the guiding guys!
  6. i can get acces to it the 2 domains. Then what what Alex and Barand suggested is the right thing right?
  7. Alright i think you're saying its possible to connect to 2 different servers in one script? I've looked up on this and i found this: <?php // we connect to example.com and port 3307 $link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); // we connect to localhost at port 3307 $link = mysql_connect('127.0.0.1:3307', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?> Do you know for sure its possible to connect to 2 different servers at once? If so i'd love to have a confirmation on that because it all seems not possible ;p
  8. Thanks for the quick response guys! However how will i do this? can i connect to another server in the same script? The second server is a mysql database as well if that is what you mean. If you could give me a little start to what functions i should use i can work my way from there i think. Thanks!
  9. Hello everybody! I'm here today with a mystery i can't solve... The problem i'm having is that i need to be able to transfer mysql data from one server to another one. Retrieving data from the one database is easy, but making it transfer to another server is not that easy for me. I have it printing out the data ATM This is how i retrieve data from one server: <?php $dbhost = ""; $dbname = "eg_xenforo"; $dbuser = ""; $dbpass = ""; $conn = mysqli_connect("$dbhost","$dbuser","$dbpass","$dbname") or die("Error " . mysqli_error($conn)); $sql= "SELECT username FROM xf_user WHERE FIND_IN_SET('9',secondary_group_ids) UNION SELECT username FROM xf_user WHERE FIND_IN_SET('10',secondary_group_ids) UNION SELECT username FROM xf_user WHERE FIND_IN_SET('12',secondary_group_ids)"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { $name = $row['username']; echo "$name <br>"; } } else { echo "0 results"; } ?> This is what i get as result: CosmonautBob ooglebrain JamieKG Quinnter16 Jordan Zoehamp skynet1123 misscupcake1306 Sir Crimson These are usernames that should be added onto another server in a database table. Any suggestions? Thanks in advance!
  10. Thanks that worked out great! I didnt know primary key could be added on multiple columns, now i know! Thanks alot!
  11. I tryd it but the sql didnt work I'm trying to check mutiple criteria in one row if its already in my database the newly sent record should not be added. I'm going to give you an example of what a record looks like: Name Color Type Sub-Type Power Toughness CMC Rarity Expansion Foil Stock Kite Shield Colorless Artifact Equipment 0 Uncommon M12 No 1 The top row are the names of the colums the bottom row is the data stored. The thing is another row could be exactly the same as the one above with the expansion changed or the Foil status changed or the name slightly changed. So i'd have to check atleast these 3 criteria in one row to know for sure its not in there already. I hope this explains alot more :/ I basicly need to be able to check for 3 different criteria in one row to be sure its not the same. If you look at the second and 3rd row on the webite you'll see that checking the name for differences is not enough because the Foil row is different. If you type in Loxodon Warhammer in the first input box and press enter you'll see that the Expansion and the Rarity is different. So i hope now you understand what i'm trying to achieve here. I hope you understand more now. This is my website: http://osiriselkeleni.be So you can see what setup i have atm. Thanks for helping me out!
  12. This is a dummy question but i cant get multiple criteria in the count function. This is what i'm trying to do: SELECT COUNT(Name, Expansion, Foil) AS NameCheck FROM Osiris WHERE Name="$name" Expansion="$expansion" Foil="$foil" I have Colums named: `Name` `Color` `Type` `Subtype` `Power` `Toughness` `Manacost` `Rarity` `Expansion` `Foil` `Stock` I want to check before i enter a new record if its not already there, by checking the Name, Expansion and Foil colum on the same record. I think i have just messed up that code line but i cant seem to find any solution on the web. Thanks in advance!
  13. This did do the trick! Thanks alot! I don't fully understand what all this does, so i rather not use it for now i could look into it but its working fine now, If you want to explain this piece of code i'd love to learn it but i dont really like to implement things in my web unless i understand it a bit and know how to mess around with it. Still you helped me and thanks for that!
  14. hey guys! i'm back again with another question I've been messing with the piece of code for a few days now and can't get it to function properly. i'm trying to make each row a different color which works... BUT it leaves out some data and prints it double... This is the piece of code that will help you find what i've been doing wrong... $color="1"; while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC)) { if($color==1){ $cardname = $row['Name']; $encodedcardname = str_replace(" ","%20",trim($cardname)); $url = "http://mtgimage.com/card/$encodedcardname.jpg"; echo "<tr bgcolor=''><td>"; echo "<a href=$url>$cardname</a>"; echo "</td><td>"; echo $row['Color']; echo "</td><td>"; echo $row['Type']; echo "</td><td>"; echo $row['Subtype']; echo "</td><td>"; echo $row['Power']; echo "</td><td>"; echo $row['Toughness']; echo "</td><td>"; echo $row['Manacost']; echo "</td><td>"; echo $row['Rarity']; echo "</td><td>"; echo $row['Expansion']; echo "</td><td>"; echo $row['Foil']; echo "</td><td>"; echo $row['Stock']; echo "</td></tr>"; $color="2"; } else { echo "<tr bgcolor='#F8F8F8'><td>"; echo "<a href=$url>$cardname</a>"; echo "</td><td>"; echo $row['Color']; echo "</td><td>"; echo $row['Type']; echo "</td><td>"; echo $row['Subtype']; echo "</td><td>"; echo $row['Power']; echo "</td><td>"; echo $row['Toughness']; echo "</td><td>"; echo $row['Manacost']; echo "</td><td>"; echo $row['Rarity']; echo "</td><td>"; echo $row['Expansion']; echo "</td><td>"; echo $row['Foil']; echo "</td><td>"; echo $row['Stock']; echo "</td></tr>"; $color="1"; } } echo "</table>"; A picture of the result of whats it outputting right now is attached to this thread. Thanks in advance!
  15. The data will only be stored by me and some friends but if that solves the problem i will look into how to do that (beginner) Thanks ill post the result!
  16. Hello everyone, I have a card database and everything works perfectly besides one thing.. I can't store ' in my database via my form, i however do can store them into the database via PHPMyAdmin. I dont know what i've been doing wrong and it really bothers me. If any of you guys could help me out. Here's all the code you would need to find the issue. This is the form file <!doctype html> <html> <head> <meta charset="utf-8"> <title>Edit Page</title> </head> <body> <h1 align="center"> Add Cards</h1> <form action="insert.php" method="POST"> <input type="text" name="name" placeholder="Name" /> <input type="text" name="color" placeholder="Color" /> <input type="text" name="type" placeholder="Type" /> <input type="text" name="subtype" placeholder="Sub Type" /> <input type="text" name="power" placeholder="Power" /> <input type="text" name="toughness" placeholder="Toughness" /> <br> <input type="text" name="manacost" placeholder="Converted Mana Cost" /> <input type="text" name="rarity" placeholder="Rarity" /> <input type="text" name="expansion" placeholder="Expansion" /> <input type="text" name="foil" placeholder="Foil" /> <input type="text" name="stock" placeholder="Stock" /> <input type="submit" value="Save" /> </form> </body> </html> This inserts it into my database. <?php ($GLOBALS["___mysqli_ston"] = mysqli_connect("", "", "", , ))or die("cannot connect"); ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE e_industries"))or die("cannot select DB"); $name = $_POST['name']; $color = $_POST['color']; $type = $_POST['type']; $subtype = $_POST['subtype']; $power = $_POST['power']; $toughness = $_POST['toughness']; $manacost = $_POST['manacost']; $rarity = $_POST['rarity']; $expansion = $_POST['expansion']; $foil = $_POST['foil']; $stock = $_POST['stock']; $sql="INSERT INTO Osiris (Name, Color, Type, Subtype, Power, Toughness, Manacost, Rarity, Expansion, Foil, Stock) VALUES ('$name', '$color', '$type', '$subtype', '$power', '$toughness', '$manacost', '$rarity', '$expansion', '$foil', '$stock')"; $result=mysqli_query($GLOBALS["___mysqli_ston"], $sql); if($result){ echo "Successful"; echo "<BR>"; echo "<a href='add.html'>Back to main page</a>"; } else { echo "ERROR"; } ?> If anyone could help me out that would be great!
  17. I will do that, its just i'm still a beginner at this and now that i (kinda) understand this code its really not that easy to jump and change everything around But as you bring up the malicious users, i will try and convert it into MySQLI Thanks alot guys!
  18. Thanks alot! it works like a charm! just need to figure out how i can input ' into names cuz i cant store them into my database and its as good as done! Really helpfull forum!
  19. Thanks QuickOldCar, How ever i have one more question.. It seems that when i use spaces in the card names that the variable doesn't coppy it in the HREF link. Is there an easy fix for it? Or should i use _ instead of spaces? Thanks for all the help Guys!
  20. Okay thanks that works, but now all the other data isnt showing anymore... Anyone knows what the cause is? This is a link to the actual website <!DOCTYPE html> <html> <head> <title>MTG Card List</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css" media="screen"> @import "filtergrid.css"; body{ margin:15px; padding:15px; border:0px solid #666; font-family:Arial, Helvetica, sans-serif; font-size:88%; } h2{ margin-top: 50px; } caption{ margin:10px 0 0 5px; padding:10px; text-align:left; } pre{ font-size:13px; margin:5px; padding:5px; background-color:#f4f4f4; border:1px solid #ccc; } .mytable{ width:100%; font-size:12px; border:1px solid #ccc; } th{ background-color:#003366; color:#FFF; padding:2px; border:1px solid #ccc; } td{ padding:2px; border-bottom:1px solid #ccc; border-right:1px solid #ccc; border-left:1px solid #ccc; border-top:1px solid #ccc; } body p { font-size: 50%; color: #000; } a:link { color: #000; } a:visited { color: #000; } </style> <script language="javascript" type="text/javascript" src="actb.js"></script> <script language="javascript" type="text/javascript" src="tablefilter.js"></script> </head> <body> <form align="center" action="password.php" method="POST"> <b>Username:</b> <input type="text" name="username"> <b>Password:</b> <input type="text" name="password"> <input type="submit"> </form> <?php $dbhost = ''; $dbuser = ''; $dbpass = ''; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } mysql_select_db('e_industries'); $sql = 'SELECT `Name`, `Color`, `Type`, `Subtype`, `Power`, `Toughness`, `Manacost`, `Rarity`, `Expansion`, `Foil`, `Stock` FROM `Osiris`'; $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } echo '<table align="center" id="mytable" cellspacing="0" class="table" >'; echo "<tr><th >Name</th><th >Color</th><th >Type</th><th >Sub Type</th><th >Power</th><th >Toughness</th><th >Converted mana cost</th><th >Rarity</th><th >Expansion</th><th >Foil</th><th >Stock</th></tr>"; while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) $cardname = $row['Name']; $url = "http://mtgimage.com/card/$cardname.jpg"; { echo "<tr><td>"; echo "<a href=$url>$cardname</a>"; echo "</td><td>"; echo $row['Color']; echo "</td><td>"; echo $row['Type']; echo "</td><td>"; echo $row['Subtype']; echo "</td><td>"; echo $row['Power']; echo "</td><td>"; echo $row['Toughness']; echo "</td><td>"; echo $row['Manacost']; echo "</td><td>"; echo $row['Rarity']; echo "</td><td>"; echo $row['Expansion']; echo "</td><td>"; echo $row['Foil']; echo "</td><td>"; echo $row['Stock']; echo "</td></tr>"; } echo "</table>"; mysql_close($conn); ?> <script language="javascript" type="text/javascript"> //<![CDATA[ var table2_Props = { col_1: "select", col_2: "select", col_3: "select", col_7: "select", col_8: "select", col_9: "select", col_10: "none", display_all_text: " [ Show all ] ", sort_select: true }; setFilterGrid( "mytable",table2_Props ); //]]> </script> </body> </html>
  21. Hello everyone, i'm struggeling with posting a link with variables in a table with info i receive from a database. The variable $url = "http://mtgimage.com/card/$cardname.jpg"; works but the variable $cardname = $row['Name']; doesnt. i dont know what i am doing wrong in that line of code. my actual goal with this is so when i hover over the card name which i receive from the database it shows the image. This is the actual full file. <!DOCTYPE html> <html> <head> <title>MTG Card List</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css" media="screen"> @import "filtergrid.css"; body{ margin:15px; padding:15px; border:0px solid #666; font-family:Arial, Helvetica, sans-serif; font-size:88%; } h2{ margin-top: 50px; } caption{ margin:10px 0 0 5px; padding:10px; text-align:left; } pre{ font-size:13px; margin:5px; padding:5px; background-color:#f4f4f4; border:1px solid #ccc; } .mytable{ width:100%; font-size:12px; border:1px solid #ccc; } th{ background-color:#003366; color:#FFF; padding:2px; border:1px solid #ccc; } td{ padding:2px; border-bottom:1px solid #ccc; border-right:1px solid #ccc; border-left:1px solid #ccc; border-top:1px solid #ccc; } body p { font-size: 50%; color: #000; } a:link { color: #000; } a:visited { color: #000; } </style> <script language="javascript" type="text/javascript" src="actb.js"></script> <script language="javascript" type="text/javascript" src="tablefilter.js"></script> </head> <body> <form align="center" action="password.php" method="POST"> <b>Username:</b> <input type="text" name="username"> <b>Password:</b> <input type="text" name="password"> <input type="submit"> </form> <?php $dbhost = 'hostname'; $dbuser = 'user'; $dbpass = 'pw'; $cardname = $row['Name']; $url = "http://mtgimage.com/card/$cardname.jpg"; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } mysql_select_db('e_industries'); $sql = 'SELECT `Name`, `Color`, `Type`, `Subtype`, `Power`, `Toughness`, `Manacost`, `Rarity`, `Expansion`, `Foil`, `Stock` FROM `Osiris`'; $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } echo '<table align="center" id="mytable" cellspacing="0" class="table" >'; echo "<tr><th >Name</th><th >Color</th><th >Type</th><th >Sub Type</th><th >Power</th><th >Toughness</th><th >Converted mana cost</th><th >Rarity</th><th >Expansion</th><th >Foil</th><th >Stock</th></tr>"; while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "<tr><td>"; echo "<a href=$url>. $cardname .</a>"; echo "</td><td>"; echo $row['Color']; echo "</td><td>"; echo $row['Type']; echo "</td><td>"; echo $row['Subtype']; echo "</td><td>"; echo $row['Power']; echo "</td><td>"; echo $row['Toughness']; echo "</td><td>"; echo $row['Manacost']; echo "</td><td>"; echo $row['Rarity']; echo "</td><td>"; echo $row['Expansion']; echo "</td><td>"; echo $row['Foil']; echo "</td><td>"; echo $row['Stock']; echo "</td></tr>"; } echo "</table>"; mysql_close($conn); ?> <script language="javascript" type="text/javascript"> //<![CDATA[ var table2_Props = { col_1: "select", col_2: "select", col_3: "select", col_7: "select", col_8: "select", col_9: "select", col_10: "none", display_all_text: " [ Show all ] ", sort_select: true }; setFilterGrid( "mytable",table2_Props ); //]]> </script> </body> </html> Thanks in advance!
  22. Oh i do have one more question, i have like filtering stuff at the top of the table but when i use it it just stays loading is this cuz this is a localhost? http://imgur.com/V3wIe4d
×
×
  • 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.