Jump to content

Gotharious

Members
  • Posts

    159
  • Joined

  • Last visited

About Gotharious

  • Birthday 01/07/1988

Contact Methods

  • Website URL
    http://www.gotharious.com
  • Skype
    Gotharious

Profile Information

  • Gender
    Male
  • Location
    Alexandria, Egypt

Gotharious's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello everyone, This is very weird, I have installed a theme, modified it, and it was working great, after a while, the theme started appearing in the admin area please check screenshot to see what I mean I don't know what caused this or how to fix it any help?
  2. Well, first of all your query should be like this <? $result = mysql_query("SELECT barcode.SKU FROM barcode WHERE barcode.BARCODE = '$getcode'"); ?>
  3. Hello all, I'm trying to change the way the output look like from Recursion instead of it looking like this and make it look like this here is my code <?php $user = $_GET['id']; echo '<hr>'; function display_mptt($user) { global $db; $id = $_GET['id']; // retrieve the left and right value of the $root node $sql2 = "SELECT * from mptt where id= ".$id.""; $result2 = mysql_query($sql2 ,$db); if(!$row2 = mysql_fetch_array($result2)) echo mysql_error(); echo '<h1>Your Tree</h1>'; // start with an empty $right stack $right = array(); // now, retrieve all descendants of the $root node $sql = "SELECT * from mptt WHERE `left` BETWEEN ".$row2['left']." AND ".$row2['right']." ORDER BY 'left' ASC"; $result = mysql_query($sql ,$db); // display each row while ($row = mysql_fetch_array($result)) { // only check stack if there is one if (count($right)>0) { // check if we should remove a node from the stack while ($right[count($right)-1]<$row['right']) { array_pop($right); } } // display indented node title // add this node to the stack $right[] = $row['right']; } echo str_repeat(' ',count($right)).$row['title']."<br>"; } display_mptt(1); ?>
  4. Thanks a lot, mate. that worked perfectly, tried the same with another page but that didn't work, I still have blank results see the code below <?php if ($_GET['id']) { if(isset($_REQUEST['Submit'])) { $sql = "SELECT * FROM mptt where id=".$_GET['id']." "; $result = mysql_query($sql ,$db); $row = mysql_fetch_array($result); $right = $row['right']; // UPDATE RIGHT VALUES $sql = "UPDATE mptt SET `right`=`right`+2 WHERE `right` > ". ($right - 1); if(!$result = mysql_query($sql ,$db)) echo "$sql <br>".mysql_error(); // UPDATE LEFT VALUES $sql = "UPDATE mptt SET `left`=`left`+2 WHERE `left` > ". ($right - 1); if(!$result = mysql_query($sql ,$db)) echo mysql_error(); // INSERT NEW CATEGORY $sql = "INSERT INTO mptt (`left`,`right`,`title`) values ('".$right."', '".($right +1)."', '".$_REQUEST['title']."')"; if(!$result = mysql_query($sql ,$db)) echo mysql_error(); } else { ?> <table> <form name="form1" method="post" action="<? echo $_SERVER['REQUEST_URI']; ?>"> <tr><td> Full Name: <input type="text" name="title"></td></tr> <tr><td> Mobile: <input type="text" name="title"></td></tr> <tr><td> National ID: <input type="text" name="title"></td></tr> <tr><td> Password: <input type="text" name="title"></td></tr> <tr><td> Type: <input type="text" name="title"></td></tr> <tr><td><input type="submit" name="Submit" value="Submit"></td></tr> </form> </table> <? } } function display_mptt($root) { global $db; echo '<table border="0" width="200">'; // retrieve the left and right value of the $root node $sql2 = "SELECT * from mptt where id=".$root.""; //$sql = "SELECT left,right FROM mptt WHERE `id`=1"; $result2 = mysql_query($sql2 ,$db); if(!$row2 = mysql_fetch_array($result2)) echo mysql_error(); echo '<h1>Adding Users</h1>'; // start with an empty $right stack $right = array(); // now, retrieve all descendants of the $root node $sql = "SELECT * from mptt WHERE `left` BETWEEN '".$row2['left']."' AND '".$row2['right']."' ORDER BY `left` ASC"; $result = mysql_query($sql ,$db)or die(mysql_error()); // display each row while ($row = mysql_fetch_array($result)) { // only check stack if there is one if (count($right)>0) { // check if we should remove a node from the stack while ($right[count($right)-1]<$row['right']) { array_pop($right); } } // display indented node title echo '<tr><td>'.str_repeat(' ',count($right)).$row['title'].'</td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$row['id'].'">[ add ]</a></td></tr>'; // add this node to the stack $right[] = $row['right']; } echo '</table>'; } display_mptt(1); echo "<hr>"; ?>
  5. Hello, Here's the weird thing, some of the pages shows the results, and some pages just won't show results at all, and I'm not getting any errors here is the one that doesn't <? function display_mptt($user) { global $db; // retrieve the left and right value of the $root node $sql2 = "SELECT * from mptt where id='25'"; $result2 = mysql_query($sql2 ,$db); if(!$row2 = mysql_fetch_array($result2)) echo mysql_error(); echo '<h1>Users List</h1>'; // start with an empty $right stack $right = array(); // now, retrieve all descendants of the $root node $sql = "SELECT * from mptt WHERE 'left' BETWEEN '".$row2['left']."' AND '".$row2['right']."' ORDER BY 'left' ASC"; $result = mysql_query($sql ,$db); // display each row while ($row = mysql_fetch_array($result)or die(mysql_error())) { // only check stack if there is one $count = mysql_num_rows($result); if (count($right)>0) { // check if we should remove a node from the stack while ($right[count($right)-1]<$row['right']) { array_pop($right); } } // display indented node title // add this node to the stack $var3 = '10'; echo "<table width='589' border='1'> <tr> <th>ID</th> <th>Name</th> </tr>"; echo "<tr><td><a href=\"user.php?id=".$row['id']."\">".$row['id']."</a></td>"; echo "<td>" . $row['title'] ." </td>"; echo "</tr>"; echo "</table>"; $right[] = $row['right']; } } display_mptt(1); ?> and here is the page that does <? function display_mptt($user) { global $db; $id = $_GET['id']; // retrieve the left and right value of the $root node $sql2 = "SELECT * from mptt where id= ".$id.""; $result2 = mysql_query($sql2 ,$db); if(!$row2 = mysql_fetch_array($result2)) echo mysql_error(); echo '<h1>Your Tree</h1>'; // start with an empty $right stack $right = array(); // now, retrieve all descendants of the $root node $sql = "SELECT * from mptt WHERE `left` BETWEEN ".$row2['left']." AND ".$row2['right']." ORDER BY 'left' ASC"; $result = mysql_query($sql ,$db); // display each row while ($row = mysql_fetch_array($result)) { // only check stack if there is one if (count($right)>0) { // check if we should remove a node from the stack while ($right[count($right)-1]<$row['right']) { array_pop($right); } } // display indented node title echo str_repeat(' ',count($right)).$row['title']."<br>"; // add this node to the stack $right[] = $row['right']; } } display_mptt(1); ?>
  6. Well, all I can do is make it appear in a table that's all but I just can't make it look well structured I read the page you refered me to, but I didn't know what should I do I figured I would just merge that code from google with the code of the recursion, but just don't know how
  7. Hello all, After finally getting this tree to work, I'm having trouble with the output now it looks like this 1 2 3 4 5 6 7 8 9 10 11 While 8 is a child of 2 not 7 although when I open the tree of 2 only, it gives the right sorting now I want to fix this, also is there a way to make it appear more like this? http://code.google.com/apis/chart/interactive/docs/gallery/orgchart.html
  8. Ok, thanks thorpe, I checked that but didn't get a clue of what I should do. What I'm trying to do here is to make the tree that looks like this 1 2 3 4 5 6 7 8 to look like this http://sameh.files.wordpress.com/2006/05/Organization%20Structure2.jpg
  9. Ok, I solved this with the same pre-order recursion I used to display the MLM downline tree structure I just made it instead of echoing the results of the recursion, to count the num of rows, subtract 1 then multiply by 10 which worked perfectly, as when counting the number of rows, it counts the row of the person I'm trying to find his commission out, so I had to remove it by subtracting one then mutliply it by 10 which is his commission for each person under him here is the code <? $user = $_GET['id']; echo '<hr>'; function display_mptt($user) { global $db; // retrieve the left and right value of the $root node $sql2 = "SELECT * from mptt where id= ".$user.""; $result2 = mysql_query($sql2 ,$db); if(!$row2 = mysql_fetch_array($result2)) echo mysql_error(); echo '<h1>Your Tree</h1>'; // start with an empty $right stack $right = array(); // now, retrieve all descendants of the $root node $sql = "SELECT * from mptt WHERE `left` BETWEEN ".$row2['left']." AND ".$row2['right']." ORDER BY 'left' ASC"; $result = mysql_query($sql ,$db); // display each row while ($row = mysql_fetch_array($result)) { // only check stack if there is one if (count($right)>0) { // check if we should remove a node from the stack while ($right[count($right)-1]<$row['right']) { array_pop($right); } } // display indented node title $commission =mysql_num_rows($result); $var3= '10'; $total= ($commission - 1) * $var3; echo $total; // add this node to the stack $right[] = $row['right']; } } display_mptt(1); ?>
  10. Hello all, I want to make this recursive function of php <? $user = $_GET['id']; echo '<hr>'; function display_mptt($user) { global $db; // retrieve the left and right value of the $root node $sql2 = "SELECT * from mptt where id= ".$user.""; $result2 = mysql_query($sql2 ,$db); if(!$row2 = mysql_fetch_array($result2)) echo mysql_error(); echo '<h1>Your Tree</h1>'; // start with an empty $right stack $right = array(); // now, retrieve all descendants of the $root node $sql = "SELECT * from mptt WHERE `left` BETWEEN ".$row2['left']." AND ".$row2['right']." ORDER BY 'left' ASC"; $result = mysql_query($sql ,$db); // display each row while ($row = mysql_fetch_array($result)) { // only check stack if there is one if (count($right)>0) { // check if we should remove a node from the stack while ($right[count($right)-1]<$row['right']) { array_pop($right); } } // display indented node title echo str_repeat(' ',count($right)).$row['title']."<br>"; // add this node to the stack $right[] = $row['right']; } } display_mptt(1); ?> Appear in a structure like the one from Google Chart located here http://code.google.com/apis/chart/interactive/docs/gallery/orgchart.html and here is their code <html> <head> <script type='text/javascript' src='https://www.google.com/jsapi'></script> <script type='text/javascript'> google.load('visualization', '1', {packages:['orgchart']}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Name'); data.addColumn('string', 'Manager'); data.addColumn('string', 'ToolTip'); data.addRows([ [{v:'Mike', f:'Mike<div style="color:red; font-style:italic">President</div>'}, '', 'The President'], [{v:'Jim', f:'Jim<div style="color:red; font-style:italic">Vice President</div>'}, 'Mike', 'VP'], ['Alice', 'Mike', ''], ['Bob', 'Jim', 'Bob Sponge'], ['Carol', 'Bob', ''] ]); var chart = new google.visualization.OrgChart(document.getElementById('chart_div')); chart.draw(data, {allowHtml:true}); } </script> </head> <body> <div id='chart_div'></div> </body> </html>
  11. Ok, Perhaps my last post should have been in Client Side forums, but that recursion worked here is it's code for reference <? $user = $_GET['id']; echo '<hr>'; function display_mptt($user) { global $db; // retrieve the left and right value of the $root node $sql2 = "SELECT * from mptt where id= ".$user.""; $result2 = mysql_query($sql2 ,$db); if(!$row2 = mysql_fetch_array($result2)) echo mysql_error(); echo '<h1>Your Tree</h1>'; // start with an empty $right stack $right = array(); // now, retrieve all descendants of the $root node $sql = "SELECT * from mptt WHERE `left` BETWEEN ".$row2['left']." AND ".$row2['right']." ORDER BY 'left' ASC"; $result = mysql_query($sql ,$db); // display each row while ($row = mysql_fetch_array($result)) { // only check stack if there is one if (count($right)>0) { // check if we should remove a node from the stack while ($right[count($right)-1]<$row['right']) { array_pop($right); } } // display indented node title echo str_repeat(' ',count($right)).$row['title']."<br>"; // add this node to the stack $right[] = $row['right']; } } display_mptt(1); ?>
  12. Ok, I finally got this to work now but now I want to make it appear in an organizational structure, something like Google's chart http://code.google.com/apis/chart/interactive/docs/gallery/orgchart.html Here is my code, how can I make this work? <? $user = $_GET['id']; echo '<hr>'; function display_mptt($user) { global $db; // retrieve the left and right value of the $root node $sql2 = "SELECT * from mptt where id= ".$user.""; $result2 = mysql_query($sql2 ,$db); if(!$row2 = mysql_fetch_array($result2)) echo mysql_error(); echo '<h1>Your Tree</h1>'; // start with an empty $right stack $right = array(); // now, retrieve all descendants of the $root node $sql = "SELECT * from mptt WHERE `left` BETWEEN ".$row2['left']." AND ".$row2['right']." ORDER BY 'left' ASC"; $result = mysql_query($sql ,$db); // display each row while ($row = mysql_fetch_array($result)) { // only check stack if there is one if (count($right)>0) { // check if we should remove a node from the stack while ($right[count($right)-1]<$row['right']) { array_pop($right); } } // display indented node title echo str_repeat(' ',count($right)).$row['title']."<br>"; // add this node to the stack $right[] = $row['right']; } } display_mptt(1); ?>
  13. This is wrong <?php $photo_link = mysql_real_escape_string(trim($_POST['photo_link'])); ?> the post is photo not photo_link should be like this <?php $photo_link = mysql_real_escape_string(trim($_POST['photo'])); ?>
  14. I don't know much about CSS and designing tho (I hate designing to be honest) I'm more into php and such but I've checked online for your problem, and as I understand it's purely CSS, here is a link to someone talking about sub menus like yours, and in their CSS, you'll see the float position is left, perhaps if you changed that to center it would do what you want. BTW, I'm not giving a solution, I'm a total idiot when it comes to designing and positions, I'm just trying to give you an idea that my lead you to the solution http://www.sohtanaka.com/web-design/horizontal-sub-nav-with-css-jquery/
  15. I believe that's a CSS problem not PHP, check the styles sheet of this template, because also your Contact button isn't placed right. and perhaps this thread should be asked in the HTML & CSS forum
×
×
  • 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.