Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

BrowserBugs

Privileged
  • Joined

  • Last visited

Solutions

  1. BrowserBugs's post in Multiple PHP actions on one form was marked as the answer   
    Aha hang on $row['ID'] is not defined in adddel.php. You need to send the id of the row along with the form, add to the form something like ...
    <input type="hidden" name="whichRow" value="<?php echo $row['id']; ?>"> then in adddel.php ...
    $whichRow = intval($_POST['whichRow']);
  2. BrowserBugs's post in How many jQuery scripts do I need? was marked as the answer   
    I always use a local copy of the min version as I can set the cache. The two in your head is just loading 2 copies of jQuery, you only need one. Using an external version is a cross site request so would be slower.
  3. BrowserBugs's post in SQL/PHP Sorting results alphanumerically was marked as the answer   
    Sorry bud, SQL considers that a string and not a number, R9 comes before R1 in descending order, just the nature of the beast. Depending how many records you have depends what the best thing to do is. Might be worth making a varchar column for the prefix (e.g. R) and in int column for number (e.g. 1002). Then run a script to split the reference and store the prefix and int separately, but this really does depend on how much data there is, a CRON might be the better option for this.
     
    Edit: There's one way which is https://www.copterlabs.com/natural-sorting-in-mysql/ however it all depends if the prefix is always the same length.
  4. BrowserBugs's post in Problem using two paramenters in preprare statement to login was marked as the answer   
    Hmm I'm not OOP but...
    $get->bind_param('s, s', $uname, $pword); ...should probably be...
    $get->bind_param('ss', $uname, $pword); ... but not 100% sure as my statements look a little different
    mysqli_stmt_bind_param($stmt, "ss", $uname, $pword);
  5. BrowserBugs's post in Validation Function Issue (js) was marked as the answer   
    intRegex = '/[0-9 -()+]+$/'; // should be intRegex = /[0-9 -()+]+$/; Found .... glad but freaking irritating.
  6. BrowserBugs's post in $_POST code with login and registration was marked as the answer   
    It's a bit of a pickle here and a lot of your php is in the wrong place which will give double headers. In addition the html on the code is incorrect and although I write procedural (rather than OOP) I can't see any kind of data cleansing before inserting into the db? You might also want to look at what happens if the input field is blank, there's not conditional checks for the user and password.
     
    Try running this in a test.php simply for creating the session.
    <?php session_start(); if($_SERVER['REQUEST_METHOD']=='POST') { // If it has been posted $uname = trim($_POST['user']); $pword = trim($_POST['pass']); // Check if the fields are empty if($uname=="" || $pword=="") { $errmsg = "Please enter a username and password"; } else { $_SESSION["user"] = $uname; $_SESSION["pass"] = $pword; } } ?> <!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <?php if(isset($errmsg)) { echo "<p>" . $errmsg . "</p>"; } ?> <?php if(isset($_SESSION["user"]) && isset($_SESSION["user"])) { echo "<p>Session Set for user " . $_SESSION["user"] . " and password " . $_SESSION["pass"] . "</p>"; } ?> <form action="test.php" method="post"> <ul> <li>User: <input type="text" name="user"></li> <li>Password: <input type="pass" name="pass"></li> <li><input type="submit"></li> </ul> </form> </body> </html>
  7. BrowserBugs's post in output displays ascii codes rather than the character was marked as the answer   
    I think you're wanting http://php.net/manual/en/function.html-entity-decode.php
  8. BrowserBugs's post in How do i make google serach see my website as one was marked as the answer   
    .htaccess matey.
    Options +FollowSymlinks RewriteEngine On RewriteBase / Rewritecond %{HTTP_HOST} !^sethric\.com RewriteRule (.*) http://sethric.com/$1 [R=301,L] Or the reverse to force it to www ...
     
    Options +FollowSymlinks RewriteEngine On RewriteBase / Rewritecond %{HTTP_HOST} !^www\.sethric\.com RewriteRule (.*) http://www.sethric.com/$1 [R=301,L] Although yes you can set a preferred with Google it does not prevent http://domain.com/page.html and http://www.domain.com/page.html existing which is a common duplicate content pit to fall in.
  9. BrowserBugs's post in MySQLi Proceedural Prepared Statements was marked as the answer   
    Ok missed a fundamental flaw to my attempts ... to summarise "Note that all columns must be bound by the application before calling mysqli_stmt_fetch()." *sigh* need more sleep :s
     
    Edit: So it looks like this ...
     
    $con = mysqli_connect("localhost","user","password","db"); // Check connection if(mysqli_connect_errno()){ echo mysqli_connect_error(); } $search1 = "Chicken"; $search2 = "Spice"; $multidimentionalarray = array(); $query = "SELECT Col1, Col2, Col3, Col4 FROM table WHERE Col1 = ? AND Col2 = ?"; $stmt = mysqli_prepare($con, $query); mysqli_stmt_bind_param($stmt, "ss", $search1, $search2); mysqli_stmt_execute($stmt); // This is now where you must bind each col mysqli_stmt_bind_result($stmt, $rcol1, $rcol2, $rcol3, $rcol4); // This adds each row as a row in the multidimentional array while(mysqli_stmt_fetch($stmt)) { $newrow = array( 'Meat' => $rcol1, 'Style' => $rcol2, 'Cooking' => $rcol3, 'Level' => $rcol4 ); // Push it to array $multidimentionalarray[] = $newrow; } mysqli_stmt_close($stmt); mysqli_close($con); There's probably a quicker way but this works
  10. BrowserBugs's post in Detect if a string contains numbers in a sequence was marked as the answer   
    Aha!
     
    $str = "Here is some text which contains numbers like this 123 4567 or could be like this 1234567 but these 300 cheeky little numbers like 12 345 6 could appear anywhere 2003 but will always be in a row. We don't want to catch low numbers like 30."; $str = str_replace(" ", "", $str); if(preg_match_all("/\d+/", $str, $found)) { $i = 0; foreach($found[$i] as $key => $extract) { if(strlen($extract)>=6) { echo "<b style='color: red'>" . $extract . "</b> has too many numbers in a row.<br>"; } else { echo $extract . " has less than 6 numbers in a row.<br>"; } $i++; } }  
    Woohoo!
  11. BrowserBugs's post in Loosing $_SESSION Variables on Page Refresh was marked as the answer   
    On the login page you can decide if they want to logout using ?logout=1 with the following;
     
    session_start(); if($_REQUEST['logout']=="1") { session_destroy(); header("Location: index.php"); exit(); }  
    Which would clear the session data too.
  12. BrowserBugs's post in Redirect Page using PHP within HTML was marked as the answer   
    This should work.
    function redirect() { if(!isset($_SESSION['username'])) { header("Location: http://www.yourdomain.com/index.php"); exit(); } } The header information such as 301 is not required for internal stuff like this. This function call must happen before the opening <html> output.
  13. BrowserBugs's post in Incorporate MySQL DB to website using PHP was marked as the answer   
    Forgot an example, sorry. On login if you set $_SESSION['username'] to the name of the logged in user and then try;
     
    <?php if(isset($_SESSION['username'])) { echo "Hello" . $_SESSION['username']; } else { echo "Hello Guest"; } ?>
  14. BrowserBugs's post in Database displays multiple times was marked as the answer   
    The foreach is in the wrong place, you want to loop the <li> and not the whole thing. The following should work.
     
    <?php include_once 'handler.php'; $teams = getTeams(); ?> <link href="jquery_news_ticker/styles/ticker-style.css" rel="stylesheet" type="text/css" /> <script src="jquery_news_ticker/includes/jquery.ticker.js" type="text/javascript"></script> <ul id="js-news" class="js-hidden"> <?php foreach ($teams as $team) { $leden = getLeden($team["id"]); ?> <li class="news-item"><a href="#"><?php echo $team ["telefoon"]; ?></a></li> <?php } ?> </ul> <script type="text/javascript"> $(function () { $('#js-news').ticker(); }); </script>
  15. BrowserBugs's post in yet another - "how much should I charge" was marked as the answer   
    2k, 3k seems ok, maybe more. Essentially how much they are prepared to invest is the key. Not to fleece them but if they only want to spend £1k what in reality can be achieved?
     
    It's all down to how much effort goes in, especially in the testing and seo scanning for bugs but with a good budget there will be ample time to check every process, every email, all the urls, logins, browsers etc.
     
    I did a recent reface (scratch built cms) with extra features and stuff, launched two weeks ago and so far has resulted in a 353.34% gain in query impressions, doubling the query variants and a 102.75% increase in clicks since launch - but then the client can see value in investing £4k - £5k for this; their 'real' conversions into sales all confirm the data. But what if they only had £1k? What would have been skipped to fit this budget? Moon on a stick comes to mind.
  16. BrowserBugs's post in PHP login triggers internet security alert was marked as the answer   
    Aha fixed! The header location must have an exit(); else the internet security software thinks you will continue running a script after the page redirects. This however would appear to only be required to appease the internet security as it 'technically' works without.
     
    <?php header('Location: http://www.somewhere.com/'); exit(); ?>

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.