Jump to content

barryflood22

Members
  • Posts

    64
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

barryflood22's Achievements

Member

Member (2/5)

0

Reputation

  1. Got it working with this script <?php $host = 'localhost'; $user = ''; $db = ''; $password = ''; // Create connection $link = mysql_connect($host, $user, $password); mysql_select_db($db, $link); $result = mysql_query("SELECT * FROM jos_content", $link); while($row = mysql_fetch_array($result)){ echo $row['title']; } ?>
  2. Just changed it to this but still no luck <?php $host = 'localhost'; $user = ''; $db = ''; $password = ''; // Create connection mysql_connect($host, $user, $password, $db) or die(mysql_error()); echo "Connected to MySQL<br />"; ?> <?php $result= mysql_query("SELECT * FROM jos_content"); while($row = mysql_fetch_array($result)){ echo $row['title']; } ?>
  3. I am having issues with a basic PHP echo script. I am trying to echo all titles in a table, the table name is right and the database is connecting as I am getting a "connected" message appearing on screen, apart from that i'm getting absolutely nothing being output. I have removed the passwords for obvious reasons. <?php $host = 'localhost'; $user = ''; $db = ''; $password = ''; // Create connection $con=mysqli_connect($host,$user,$password,$db); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else echo "connected"; ?> <?php $result= mysql_query("SELECT * FROM jos_content"); while($row = mysql_fetch_array($result)){ echo $row['title']; } ?>
  4. I need to stop answering my own questions, I created a language file :-) <?PHP //Have seperate language files for each language I add, this would be english file function lang($phrase){ static $lang = array( 'COM_COMMUNITY_LANG_NAME_UNITEDKINGDOM' => 'The UK', 'COM_COMMUNITY_LANG_NAME_IRELAND' => 'Ireland' ); return $lang[$phrase]; } ?>
  5. I have a script which is running which pulls data from a database, however - it is stored like this in the database: COM_COMMUNITY_LANG_NAME_IRELAND when I call it it echos the same, I want the above to say "Ireland" instead. is this something you can help with?
  6. I may have sorted it, can you guys check this is correct?
  7. I have a piece of script below that I wrote, but I don't want it to echo both results. I only want it to techo one of them. I think if it was something like this it would work: if 'column1' is not empty then echo 'value'. im having a bit of trouble getting it to do that, please help :-( <?php $signatureslist = mysql_query("SELECT * FROM $table, $usernamestable Where $table.subscriber_id= $usernamestable.id and $table.list_id='$listid' ORDER BY subdate desc limit 20 ", $link); while ($row = mysql_fetch_assoc($signatureslist)) { echo '<li style="padding:5px 0 5px 0;"><strong class="largertext" style="color:#e6b532">'; echo $row[name]; echo ' </strong><br /><div style="margin-top:-6px">from '; echo $row[column1]; $registeredcountry = mysql_query("SELECT * FROM z1gv4_community_fields_values where user_id =" . $row[user_id] . " and field_id = " . $field_id . "", $link); while ($row2 = mysql_fetch_assoc($registeredcountry)) { echo $row2[value]; }
  8. The below is script is part of a script which echo's a list of information with links from a database, it counts how many rows there are and displays the number beside it. would anyone be able to edit it so that if the row count = 0, then it should not display any heading for that row? <?php /** * @package RAM_ListSectors * @version 1.6.0 Stable, June 2012 */ class mod_RAM_ListSectorsHelper { // // get list of sectors from Recruitment Agency Manager // function getSectorList($no_to_display) { global $msg; $sectors = array(); //get the database configuration settings $conf =& JFactory::getConfig(); $dbprefix = $conf->getValue('config.dbprefix'); // get a handle for the std joomla DB connection (only so we can get data already translated by Joomfish!) $db =& JFactory::getDBO(); $query="SELECT * FROM ".$dbprefix."RAM_Sectors ORDER BY display_order, `desc` ASC limit 0, $no_to_display "; // $msg = "SQL: $query<br />\n"; $db->setQuery( $query ); // for Joomfish! $sth = $db->loadAssocList(); // for Joomfish! $num_rows = count($sth); // records found? if ($num_rows>0) { // yes $rownum=0; // yes while ($row=$sth[$rownum]) { $sectors[] = $row; // add the sector details to the array $rownum++; // go to the next record } } else { // no, return error message $msg = JText::_('RAM_LSM_NOSECTORS'); } // eof check for records found return $sectors; // return any sectors found } // end function getSectorList // // Get the no. of jobs for a specified sector // function getJobs($sector) { //get the database configuration settings $conf =& JFactory::getConfig(); $dbprefix = $conf->getValue('config.dbprefix'); // get a handle for the std joomla DB connection (only so we can get data already translated by Joomfish!) $db =& JFactory::getDBO(); $query="select count(*) from ".$dbprefix."RAM_jobs where `sector` = '$sector' and jobfilled='n' AND `approved`='y' and published='y' "; $db->setQuery( $query ); $sth = $db->loadAssocList(); $row=$sth[0]; $num_rows=$row['count(*)']; return $num_rows; } // end function getJobs } // eof class ?>
  9. I cant get this script to work, anybody have any ideas? <?php //ECHO LOCATION echo '<p><b>Location: </b>'; // get area details $query2="select * from jos_RAM_areas WHERE id = '".$row['area']."' "; $sth2=mysql_query($query2); $Location=$sth2['fullname']; $Area = "$Location"; echo $Area; $town_city = $row['town_city']; if ($town_city!='') { echo "\n\n$town_city"; } ?>
  10. i have two tables cross referencing each other but for some reason it wont populate the "country" results, below is my code, can anyone help? <?php //ECHO LOCATION echo '<p><b>Location: </b>'; // get area details $query2="select * from jos_RAM_areas WHERE id = '".$row['area']."' "; $sth2=mysql_query($query); $num_rows2 = count($sth2); // record found? if ($num_rows2>0) { $row2=$sth2[0]; // get the record details (now in an array) $Country=$row2['Country']; $County=$row2['County']; if ($County!='') { $Area = "$Country, $County"; } else { $Area = "$Country"; } } else { } // eof check for record found echo $Area; $town_city = $row['town_city']; if ($town_city!='') { echo "$country\n\n$town_city"; } ?>
  11. i worked it out myself :-) $cdate=date("Y-m-d"); // get the current date $sql = "SELECT * FROM $tbl_name where enddate>='$cdate' ORDER BY dateposted DeSC LIMIT $start, $limit";
  12. i have a script which populates all listings in a table and echo's them as nicely laid out records on the front end. i want it to ignore all records which has had its "enddate" passed, below is what i have $sql = "SELECT * FROM $tbl_name ORDER BY dateposted DeSC LIMIT $start, $limit"; $closingdate ="enddate"; i want to add something like if $closingdate < todaysdate then ignore; any ideas?
  13. no difference, I have been working at my version and have made some progress, its not populating a list id id's under contract dropdown but it still doesnt make a difference to the search results <script type="text/javascript"> function GetLocation(str) { // var data = document.getElementById("sector").value; //alert(str); // var locid = document.getElementById('SearchLocation').value; if (str == "All"){ alert("Plaease select a Role Type"); document.getElementById("sector").focus(); document.getElementById("sector").select(); return false //location.reload(true); } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) {//alert(innerHTML=xmlhttp.responseText); document.getElementById("location").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","http://<?php echo $_SERVER[HTTP_HOST]; ?>/dev/getLoc.php?loc="+str,true); xmlhttp.send(); } </script> <?php //get the database configuration settings $conf =& JFactory::getConfig(); $dbhost = $conf->getValue('config.host'); $dbuser = $conf->getValue('config.user'); $dbpassword = $conf->getValue('config.password'); $dbname = $conf->getValue('config.db'); $dbprefix = $conf->getValue('config.dbprefix'); // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); // Check for any error message from our helper if ($msg!='') { echo "<p>$msg</p>\n"; } // display the list of sectors retrieved by our helper ?> <p><?php echo $intro_para; ?></p> <form method="post" action="index.php" name="searchForm"> <p> <input type="hidden" name="option" value="com_recruitmentmanager" /> <input type="hidden" name="task" value="search" /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?>" /> <select name="sector" id="sector" onchange="GetLocation(this.value);" style='font-size: <?php echo $text_size; ?>;'> <option value="All" >Role Type</option> <?php for ($n=0; $n<count($sectors); $n++) { echo " <option value='" . $sectors[$n]['id'] . "'>" . $sectors[$n]['desc'] . "</option>\n"; } // eof for loop ?> </select> <br /> <span id="location"> <select name="area" style='font-size: <?php echo $text_size; ?>;'> <option value="">Location</option> <?php for ($n=0;$n<count($areas);$n++) { if ($show_country) { if ($areas[$n]['County']!='') { echo " <option value='" . $areas[$n]['id'] . "'>" . $areas[$n]['Country'] . ', ' . $areas[$n]['County'] . "</option>\n"; } else { echo " <option value='" . $areas[$n]['id'] . "'>" . $areas[$n]['Country'] . "</option>\n"; } } else { if ($areas[$n]['County']!='') { echo " <option value='" . $areas[$n]['id'] . "'>" . $areas[$n]['County'] . "</option>\n"; } else { echo " <option value='" . $areas[$n]['id'] . "'>" . $areas[$n]['Country'] . "</option>\n"; } } } // eof for loop ?> </select> </span> <br /> <select name="salary"> <option value="All" <?php if ($salary=='All') { echo 'selected'; } ?> >Salary</option> <?php // get list of rate bands $query="select * from ".$dbprefix."RAM_RateBands order by `display_order`, `desc` asc"; $sth=mysql_query($query); $num_rows = mysql_num_rows($sth); // records found? if ($num_rows>0) { while ($row=mysql_fetch_array($sth, MYSQL_ASSOC)) { $bid=$row['id']; $desc=$row['desc']; $selind=''; if ($salary==$bid) { $selind='selected'; } echo "<option value='$bid' $selind >$desc</option>"; } // eof while loop } // eof check for records found ?> </select> <br /> <select name="Contract"> <option value="All" <?php if ($salary=='All') { echo 'selected'; } ?> > Contract </option> <?php $contractquery909="select * from jos_RAM_jobs"; $sth909=mysql_query($contractquery909); $num_rows909 = mysql_num_rows($sth909); // records found? if ($num_rows909>0) { while ($row909=mysql_fetch_array($sth909, MYSQL_ASSOC)) { $jobtype=$row909['jobtype']; $selind909=''; if ($salary==$bid) { $selind909='selected'; } echo "<option value='$jobtype'>$jobtype</option>"; } // eof while loop } // eof check for records found ?> </select> <br /> or<br /> <b><?php echo JText::_('RAM_ASSM_SEARCHFOR'); ?>:</b> <input type="text" name="searchfor" size="16" value="" /> <br /><br /> <div style="text-align:right"> <input type="image" src="/img/search.png" name="search" value="Search" class="btn" style="border:0;margin-top:-10px;" /> </div> </p> </form>
×
×
  • 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.