Jump to content

irkevin

Members
  • Posts

    295
  • Joined

  • Last visited

Everything posted by irkevin

  1. Hi phpfreaks community, My name is ian and I would like to offer my services as a PHP developer. I have 9+ years of experience in PHP/MySQL, basically the WEB in itself + a strong knowledge in Symfony framework and other related framework. I work with HTML, CSS, JavaScript, jQuery, node.js, angular.js, MySQL, PHP, Symfony, CodeIgniter. Feel free to send me an email for more information: irkevin@hotmail.com Have a good day/evening Regards, Ian
  2. You mean you let the user alter you database tables? Maybe and INSERT INSERT INTO tableName(your_fields) VALUES(your_values)
  3. Hi, I have a function that display an infinite list of categories.. So far this work fine.. But now I want to display only the second level of every main category and not the subs.. Consider this: Main1 Main2 Main3 Main4 car1 Bike1 watch1 Game1 SubSub1 SubSub1 SubSub1 SubSub1 car2 Bike2 watch2 Game1 SubSub2 SubSub2 SubSub2 SubSub2 What I want to achieve is, display on Car1 Car2 Bike1 Bike2 Watch1 Watch2 Game1 Game2 Here is the code I have so far: function get_cat() { db_connect(); $sql = "SELECT * FROM category"; $result = mysql_query($sql); if(mysql_num_rows($result) > 0){ while($row = mysql_fetch_array($result)){ $menu_array[$row['id']] = array( 'name' => $row['name'], 'parent' => $row['parent_id'], 'id' => $row['id'] ); } return $menu_array; } } function generatemenu($parent,$array){ $has_childs = false; //this prevents printing 'ul' if we don't have subcategories for this category //use global array variable instead of a local variable to lower stack memory requierment foreach($array as $key => $value) { if ($value['parent'] == $parent){ $has_childs = true; if($has_childs == true){ if($value['parent'] == 0) echo '<ul class="main">'; else echo '<ul class="subs">'; } //if this is the first child print '<ul>' if($value['parent'] == 0) echo '<li><a href="index.php?category='.$value['id'].'">' . $value['name'] . '</a>'; else echo '<li><a href="index.php?category='.$value['id'].'">' . $value['name'] . '</a>'; generatemenu($key ,$array); //call function again to generate nested list for subcategories belonging to this category echo '</li>'; if($has_childs == true) echo '</ul>'; } } } Can someone help?
  4. I need to set a cookie, and later update it. Meaning, the cookie needs to retain its current value, plus add new values to it from GET variable data. Nobody to help?
  5. Hi here is my problem, i have a link like : index.php?id=1 When user click on it, a cookie array is set with a value of 1 when user clicks on another link with an id of 2, the same cookie is set with another value of 2, at the end , the cookie should read: array( [0] => 1 [1] => 2) Can someone please explain how to do this? im struggling :S
  6. You can try something like this: <?php $dbHost = $dbUser = $dbPass = $dbDatabase = $search = $_POST['search']; if ($search) // perform search only if a string was entered. { $con = mysql_connect($dbHost, $dbUser, $dbPass) or die("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or die("Failed to connect to database {$dbDatabase}. Error: " . mysql_error()); $query = "SELECT Appr_Value.Appr_ID as id, Appr_Value.Account, Asmnt_Parcel.OwnersName, Asmnt_Situs.Situs FROM Appr_Value INNER JOIN Asmnt_Parcel ON Appr_Value.Account=Asmnt_Parcel.Account INNER JOIN Asmnt_Situs ON Appr_Value.Account=Asmnt_Situs.Account WHERE Appr_Value.Account LIKE '{$search}' ORDER BY Appr_Value.Account ASC"; $result = mysql_query($query, $con) or die(mysql_error().": $query"); if ($result) { echo "Results:<br><br>"; echo "<table width=90% align=center border=1><tr> <td align=center bgcolor=#4A6B3F>Account</td> <td align=center bgcolor=#4A6B3F>Owners Name</td> <td align=center bgcolor=#4A6B3F>Situs</td> </tr>"; while ($r = mysql_fetch_array($result)) { // Begin while $act = $r["Account"]; $name = $r["OwnersName"]; $situs = $r["Situs"]; echo "<tr> <td><a href='formresults.php?id=".$r['id']."'>$act</td> <td>$name</td> <td>$situs</td> </tr>"; } // end while echo "</table>"; } else { echo "Sorry, please try your search again."; } } else { echo "Start your search"; } ?> Now when user clicks on the link, it takes you to a page similar to this http://www.yourdomain.com/formresults.php?id=1 On formresults.php, make a query like this: $query = "SELECT Appr_Value.Appr_ID as id, Appr_Value.Account, Asmnt_Parcel.OwnersName, Asmnt_Situs.Situs FROM Appr_Value INNER JOIN Asmnt_Parcel ON Appr_Value.Account=Asmnt_Parcel.Account INNER JOIN Asmnt_Situs ON Appr_Value.Account=Asmnt_Situs.Account WHERE Appr_Value.Account LIKE '{$search}' AND Appr_value.Appr_ID = '".mysql_real_escape_string($_GET['id'])."' ORDER BY Appr_Value.Account ASC";
  7. Well, as a start, I don't really understand your query. What's this: build_device_test.$'Auto_id' Please clarify. If you could show how your table are set up, that would be a good place to start!
  8. In your select statement, you need to select and ID as well, that's what you need. How is your table set up?
  9. Haha, i find myself several time in this situation xD .. You're welcome
  10. Maybe like this: <?php echo 'welcome '. $name.'<br />'; echo "<a href='women/mygirls/index.html'>logout</a>"; ?>
  11. Try visiting this link I got a similar problem also. Which was fixed by the code in this topic http://www.phpfreaks.com/forums/index.php/topic,154528.msg668929.html#msg668929
  12. Try this, <?php $conn = mysql_connect("machine", "", "") or die("Could not connect : " . mysql_error()); mysql_select_db("my_db", $conn) or die("Could not select database"); $Auto_id = $_GET['Auto_id']; // this shows in url as 1,2,3 is my auto_inc field in database $test = "SELECT * FROM build WHERE build_id = '$Auto_id'"; $result = mysql_query($test); while($row = mysql_fetch_array($result)){ $version = $row['version']; } echo $version; ?> YOu need to iterate over the data using the while loop. Try it and let me know
  13. Basically you will need to look in $_FILES, is_uploaded_file() and move_uploaded_file(), once uploaded, get the URL of the image, or maybe just the image name, and insert it in the Database.
  14. Countrygirl is trying to get specific result based on the current result. I believe she should query it by the ID of the current result to fetch all the data! Can you post your code?
  15. Basically, you need to create a link along with the ID of the result.. LIke so <a href="formresults.php?id=<?php echo ID_OF_RESULT;?>">Your number</a> On page searchjoin_more.php, your query will be similar to below <?php $id = isset($_GET['id']) ? $_GET['id'] : ''; $sql = "SELECT * FROM yourtable WHERE id = '".mysql_real_escape_string($id)."'"; ?> The page should be in .php , not html !
  16. What happends if you try a LEFT JOIN? $sql = "Select ProgrammingFoundations.student_id, ProgrammingFoundations.attendance, ProgrammingFoundationsLab.lab_attendance from ProgrammingFoundations LEFT JOIN ProgrammingFoundationsLab on ProgrammingFoundations.student_id = ProgrammingFoundationsLab.student_id"; $result = mysql_query($sql) or die(mysql_error()); if($row = mysql_fetch_array($result)) { while($row = mysql_fetch_array($result)) { echo ' lecture attendance : '. $row['attendance']; echo ' lab attendance : '. $row['lab_attendance']; } } else { echo 'not successful'; }
  17. Oops sorry, was in a hurry when typing lol.. it's 23:35 here.. guess i'm half asleep.. HAHA
  18. if i understand, you need this line 14 I test-HS-1 TestDialpl You might want to try $Tab = mysql_query("SELECT * from `Tabs` WHERE PID = '14' AND hardware = ' test-HS-1'"); But this is not a good approach. You need a unique ID in your table.. Like +---++---++-------++------------+ | ID | PID| |action| |Hardware| +---++---++-------++------------+ | 1 | 14 | | 2 | 14 | | 3 | 14 | | 4 | 14 | And so on Then $Tab = mysql_query("SELECT * from `Tabs` WHERE ID = '2'");
  19. Well maybe he didnt make a connection to the database You might need to add those code $link = mysql_connect('localhost','username','password'); mysql_select_db(yourdbname',$link);
  20. Just append or die(mysql_error()) with it to get a clear explanation of what's happening.. try code below $result = mysql_query($sql, $link) or die('Error : '.mysql_error());
  21. oops . instead of $result = $mysql_query($sql, $link); Just put the one below $result = mysql_query($sql, $link); There shouldn't be a dollar sign in front of mysql_query(), because it is a function
  22. $result = $msql_query($sql, $link); Should be $result = $mysql_query($sql, $link); What is on line 36?
  23. Why don't you just put a link? Like <?php ## Display Table and database results while($results = mysql_fetch_array($build_device_test)){ echo"<tr>"; echo "<td class='side' >".$results['version']."</td>"; echo "<td class='CBundle' >" .$results['bundle']."</td>"; echo "<td class='CDevice' >".$results['devicename']."</td>"; echo "<td class='CJava' ></td>"; echo "<td class='CMMS' ></td>"; echo "<td class='CBranch' ></td>"; echo "<td class='CJC' ></td>"; echo "<td class='selection' ><a href='delete.php?id='".$results['id']."' onclick='disp_prompt()'>Delete</a></td>"; /* I am creating the button for each row that is displayed on the table, and the disp_prompt is a basic login javascript thing I did based on alert box for the sake of seeing how to make it work. */ echo"</tr>"; } echo"</tbody>"; echo"</table>"; ?> Then on delete.php , run those codes <?php //connection info first $id = $_GET['id']; $sql = "DELETE FROM mytable WHERE id = '$id'"; $result = mysql_query($sql) or die(mysql_error()); if($result){ echo 'Yay, it has been removed'; } ?> Edit : you might want to show your Javascript disp_prompt() function.. I believe it might take the ID as it's argument !
×
×
  • 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.