skip to Main Content

Use objects from one django model to filter objects from another django objects – Mysql

I'm doing my studying project. I have 2 models: class RoutePoint(geo_models.Model): vehicle = models.ForeignKey(Vehicle, on_delete=models.CASCADE, null=False, blank=False, related_name='routepoints') point = geo_models.PointField() datetime = models.DateTimeField() class Travel(models.Model): vehicle = models.ForeignKey(Vehicle, on_delete=models.DO_NOTHING, null=False, blank=False, related_name='travels') begin = models.DateTimeField() end = models.DateTimeField() First…

VIEW QUESTION

MySQL Regexp to repeat CSV limits at 340 commas

I am trying to create regexp to validate comma separated name value pairs which starts from ID like so select 'ID,2190,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def,abc,def' regexp '^ID,[1-9][0-9]*(,[^,]+,[^,]*)*$' the above query will output 0 istead of 1, but if i reduce a pair ,abc,def this…

VIEW QUESTION

Checking DB for existing record with PHP PDO – Mysql

I am trying to check if the database has the record to prevent duplicates. I am using the following code: $stmt = $db->prepare('SELECT * FROM newsletter WHERE useremail=:useremail'); $stmt->bindParam(':useremail', $_GET['useremail'], PDO::PARAM_INT); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); if ($row) { echo "<script…

VIEW QUESTION
Back To Top
Search